Open ooflorent opened 10 years ago
Any update about this? We (at @ebuzzing) are using reactive in a new product and and really need this nasty bug to be fixed. cc @defunctzombie
So the gist of this is that function calls without this.
don't work?
Yes. Even if the function is defined into the view delegate
object.
I've tried to add
//add this to function call
expr = expr.replace(/([^\.]|^)\b[0-9a-zA-Z_$]+?\(/g, function(_, s) {
if (s.length === 0) {
return 'this.' + _;
} else {
return _[0] + 'this.' + _.slice(1);
}
})
this into https://github.com/component/reactive/blob/master/lib/utils.js#L89 to make this
before function call optional.
Reactive should be able interpolate functions. The above suite tests
<div>{ ret("foo") }</div>
whenret
is defined in the model or the view. Onlythis.ret
seems to work.Here I'm testing ways to declare the function:
fn: String -> String
fn: -> (String -> String)
(see lib/index.js#L140, lib/adapter.js#L81)Tests
Result
The last 4 tests raise an error: