Skip to content

Latest commit

 

History

History
73 lines (59 loc) · 1.65 KB

TODO.md

File metadata and controls

73 lines (59 loc) · 1.65 KB

Maybe This Stuff?

%w[a v b]

  • Creates array of strings separated by spaces, like Ruby’s.

<<

/** bs **/ $bar << <li>foo << <li>bar;
/** js **/ $bar.append('<li>foo').append('<li>bar');

This is cool because: it makes it easier and more readable to construct your HTML programmatically, otherwise you get lots of nested brackets.

Note, this operator is a little unfortunate considering the angular brackets of the inline HTML, so we should think of something better.

Use parenthesis to append at different levels in the DOM:

$bar << (<ol> << <li>#{foo} << <li>#{bar});

Ruby-style Block Syntax

/** bs **/ [1,2,3].map{ |x| x * 2 }.each{ |x| console.log(x); }
/** js **/ [1,2,3].map(function(x){ return x * 2; }).each(function(x){ console.log(x); })
  • Rationale: less visual noise
  • Make the “context” of the map call be the iterated element

p Debug Logger

return&log foo;
  • returns the value, but logs it first.

Inline SCSS

We have Inline HTML, so we should also support inline CSS, but let’s do it with SCSS and then (with a bit of effort), support having variables in both the JS and the CSS.

Function Parameter Defaults

This is common to compile-to-JavaScript languages. But I’m not sure about it as—frankly—it doesn’t feel very “Javascripty”.

Convenience try syntax for functions

function foo() try {
    bar();
} catch (e) {
    console.error(e);
}

Becomes:

function foo() { try {
    bar();
} catch (e) {
    console.error(e);
}}