CoffeeScriptRedux
CoffeeScriptRedux copied to clipboard
Object error
i wrote a smal test with the CanJS framework.
$ ->
can.Control.extend "sp.plugin.myPlugin",
pluginName : 'myPlugin',
defaults:
myText: 'foo'
,
init: (el) ->
alert @options.myText
$('body').myPlugin()
on coffee-script 1.7.0 the output is what i expected.
$(function() {
can.Control.extend("sp.plugin.myPlugin", {
pluginName: 'myPlugin',
defaults: {
myText: 'foo'
}
}, {
init: function(el) {
return alert(this.options.myText);
}
});
return $('body').myPlugin();
});
on redux i get an error
Syntax error on line 6, column 2: unexpected ',' (\u002C)
3 : pluginName : 'myPlugin',
4 : defaults:
5 : myText: 'foo'
6 : ,
^ :~~^
7 : init: (el) ->
8 : alert @options.myText
9 :
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
See https://github.com/michaelficarra/CoffeeScriptRedux/wiki/Intentional-Deviations-From-jashkenas-coffee-script
i looked at it before and didnt find an answer
The dedented comma style that is typically discouraged is not yet supported. See related issue #232. Also, it's interesting that the leading whitespace in the error message seems to have disappeared.
ok.. but is there a workaround?
Just add the brackets
I would give the object a name.