Closed SuperPaintman closed 8 years ago
Awesome, thanks for doing this! Would you be interested in converting the last details also? Off the top of my head:
var
declarations and replace them by either const
or let
{ onEnter: function (args) {}, onLeave: function (retval) {} }
to { onEnter(args) {}, onLeave(retval) {} }
Cheers!
Also, change the injected scripts to use backticks instead of doing "" + "" +
etc :tada:
@oleavr, @SomeoneWeird Done :)
Sweet! It would be great to also omit the space between onEnter
and (
, and perhaps also remove the vertical alignment (it was there already, but I just thought of it now), so the code layout is stable even if a variable is renamed later.
I removed the space
Nice work! What do you think about getting rid of the last var
occurences also?
@oleavr they can't be replaced by a const
, because we replace placeholder '%addr%'.
@SuperPaintman That's fine, const
just means it's not possible to assign a new value to the variable, so in such cases we should use let
(var
is legacy). The '%addr%' placeholder is replaced when the script is generated, but before it is loaded, so even those variables should be const
(as long as we never reassign, or need to declare the variable without assigning in order to assign it later).
@oleavr Oh, sorry, I do not fully understood the concept of the new variables in ES6. Now i replaced var
to let
@SuperPaintman No worries! I've added some more comments on the issues I noticed. By the way, maybe we also want to switch the examples to using co
? That way we'd get rid of the callback chaining spaghetti that we have had so far (because we couldn't use co
due to lack of ES6 support). Here's an example: https://gist.github.com/oleavr/a22d675b76e7509cd2c9#file-app-js
And I also noticed that maybe we want to rename script
to source
, to distinguish the source-code from the resulting script object (it's also named source
at the API level).
@oleavr thanks for suggested to learn the CO. This is probably my best experience of this week!
Nice work! Thanks a lot, and sorry for the delay here.
Hi! I rewrote the examples using the ES6, and format them.