mozilla :: #webdev

16 Mar 2017
17:58ErikRose_rhelmer: Working on :member: option: https://github.com/erikrose/sphinx-js/issues/7
17:58rhelmernice
17:59rhelmerman it's going to be so much work to beat Firefox code into shape :/ I wonder if post-57 we should go do a big push to remove code that isn't useful, and document the code that we're keeping...
17:59ErikRose_At least you'll only have to do it once, instead of continually copying and pasting onto MDN.
18:01rhelmersrsly...
18:01rhelmerErikRose_: "neglecting to copy/paste changes onto MDN" is more like it :P
18:02rhelmeralso tbqh a lot of the code snippets on MDN could stand some review, not just on the technical writing but on correctness/best practice/etc
18:03rhelmerfor internal docs I think optimizing for correctness over better prose is not ideal but OK
18:04rhelmerweb standards should be held to a higher standard
18:11ErikRose_As long as we have an easy way to submit patches :-)
18:27OsmoseIt'd be interesting to see how you could generate a compatibility table from Sphinx markup
18:28ErikRoseProbably with a custom Sphinx directive
18:28OsmoseThere's already some deprecation directives
18:28ErikRoseAssuming all the various routines and selectors and such have "introduced in 57" in them someplace.
18:28rhelmerErikRose_: yeah. mdn is a much lower bar for contribution, having to clone a repo is painful.
18:29ErikRoseIf only we had it on GH.
18:29rhelmerheh, well there are mirrors like gecko-dev
18:29ErikRoseAny writeable?
18:30rhelmerI'm not sure how the syncing happens - I suspect it's one-way from hg->git
18:30ErikRoseyeah
18:30ErikRoseI fear so as well.
18:30ErikRosegps would know.
18:30rhelmerbut, two-way syncing is being worked on... rust crates, servo, etc. live on github and need it.
18:30rhelmerright
18:30ErikRoseAnyway, a problem for another day
18:31rhelmeryeah. two-way sync to/from gh is something gps is working on for servo/quantum I believe
18:32rhelmerif we can pull it off, I think that'll be a pretty good way to go. then smaller projects can live on github and work as normal, but we'll have a single repo that Firefox and all dependencies ships from
18:39ErikRoseWe'll have to come up with something stronger than a SHA1 hash to tie them together.
18:42rhelmerfair enough. speaking of gps he wrote this after the recent sha1 collision http://gregoryszorc.com/blog/2017/02/28/mercurial,-sha-1,-and-trusting-version-control/
18:45rhelmerErikRose: I'd like to get at least the AddonManager APIs done as a proof-of-concept before trying to get more people on board for cleaning up our jsdoc and using sphinx-js ... I think it's pretty close. We need to figure out what our private/public concept is going to be (I think @private annotations are probably good enough... we could probably have a jsdoc
18:45rhelmereslint rule that errors if methods marked private are used outside of their module. or something.
18:46rhelmerthere are some pretty cool mozilla-specific eslint rules we should try to push upstream, like balanced-listeners is nice.
18:47ErikRoserhelmer: I'm implementing private-member-skipping as part of :members:.
18:47ErikRoseAnd I'm having a :private-members: flag for including them if you wish.
18:48rhelmerErikRose: good idea
18:48ErikRoseAnd I figured out how to tell getters and setters and normal methods apart.
18:48rhelmeroh nice
18:48ErikRoseAnd I'm implementing :exclude-members: because it's easy.
18:49rhelmersome of these modules are huge, I think automodule is going to be necessary.. it'd be nice if it just had sensible defaults like private members skipped by default etc
18:49ErikRose:members: on autoclass will.
18:49rhelmercool
18:50ErikRoseSo yeah, why not.
18:50rhelmeryeah autoclass is probably more the right level than the whole module, given how some of these are implemented with public classes that call methods on private classes
18:50rhelmerI like the idea of having good code samples and prose in the rst, much better than raw jsdoc output
18:50ErikRoseThis closure trick is making a mess of my code.
18:50rhelmerheh
18:51rhelmerclosure trick for hiding private methods?
18:51ErikRoseNo, in Python, for passing the Sphinx app singleton to the directives
18:51rhelmerah
18:51rhelmeroh right
18:52ErikRoseI'm going to do something horrible so I don't have to do something even more horrible.
19:26jgauntI'm trying to use eventListeners to catch ppl doing an experiment breaking the rules to disqualify them - however, it seems like the function I associate with them is being executed when I declare them
19:26jgaunti.e. it *seems like* a keyDown event sends a console.log command before any keys are pressed
19:27jgauntis this expected behavior, or am I confused?
19:35ErikRosejgaunt: Weird! Is there a rogue () sitting around?
19:37jgauntErikRose: I don't *think* so, but I'm mixing my own in the context of a library that uses a lot of listeners itself
19:37ErikRoseBoy, best of luck.
19:37jgauntmore going on in the code than what I've written and understand
19:37jgauntheh, ty :)
19:39mythmonjgaunt: can you narrow down the console.log that is firing?
19:39mythmoncan i see that eventListener?
19:40ErikRoseYou could maybe replace the console object with your own thing and set a breakpoint in it. ;-)
19:41mythmonit should be possible to just look at the message logged, and grep the code for that
19:48jgauntErikRose, mythmon - I just vidyo'd with kamyar
19:48jgauntI was calling a parameterized function from my listeners
19:48jgauntrather than anon functions
19:49ErikRosehm
19:49jgaunttrying the fix, idk what to expect
19:52jgauntnow that my function calls are wrapped in anon functions it works as I expected
19:52jgauntI was foggy on his explanation but something about the listener passing an object to the function implicitly
19:53jgauntwhen the event occurs
19:53jgauntdoing a function call inhibits that somehow
19:53jgauntI am probably doing the description injustice
19:54mythmonjgaunt: can i see the code before and after?
19:55jgauntBEFORE https://irccloud.mozilla.com/pastebin/ebA0NW2a/
19:55jgauntAFTER https://irccloud.mozilla.com/pastebin/2WPicYPO/
19:55jgaunt^mythmon /me shrugs
19:56mythmonyeah, i'm not sure what Kamyar was trying to explain, but this is exactly what ErikRose thought it was
19:56jgauntthe "rogue ()" ?
19:56mythmonon a line like this, you call disqualify immediately, and then bind its return value as the listener. window.addEventListener('blur', disqualify("Loss of window focus"), false);
19:57ErikRoseYep, there ya go. You passed it the result of a function, not a function itself.
19:57mythmonwhereas with the wrapped function() { ... }, you create a function that is *not* evaluated immediately
19:57jgauntnow there's a succinct explanation, ErikRose
19:57jgauntokay, ty for explaining from another perspective
19:58ErikRosehaha :-)
21:44ErikRoserhelmer: https://github.com/erikrose/sphinx-js/commit/2bdd6879378302293d703c2d0df24064f6b79f52 Tada: :members: option.
21:44ErikRoseIt doesn't yet respect privacy or take lists of members or take exclusions, but it works and makes getters and setters and instance vars look nice as well.
21:50rhelmernice
17 Mar 2017
No messages
   
Last message: 42 days and 8 hours ago