Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global functions #153

Closed
ooflorent opened this issue Aug 12, 2014 · 5 comments
Closed

Global functions #153

ooflorent opened this issue Aug 12, 2014 · 5 comments

Comments

@ooflorent
Copy link
Contributor

I'm trying to call a function like:

<div>{ _('%d / %d', var1, var2) }</div>

I tried several dirty hacks such as:

  • Extending Reactive prototype
  • Using a custom adapter

Is there any way to define a function available in all views?


Update:
I'm always getting the following error:

// Uncaught TypeError: object is not a function VM2169:3
(function(reactive
/**/) {
return ['_']('%d / %d', reactive.get('current'), reactive.get('total')) 
})

But defining obj._ does not throw...

@defunctzombie
Copy link
Contributor

There is no way to do this. Views are self contained and this is by design.

@ooflorent
Copy link
Contributor Author

But defining _ into the model, the view or the adapter should work right?
Because it seems not.

@defunctzombie
Copy link
Contributor

Possibly the detection for what is a valid identifier is broken. That would be a separate issue from global functions. And yes, I think it should work so is likely a bug.

@ooflorent
Copy link
Contributor Author

Should I open a new issue?

@defunctzombie
Copy link
Contributor

Yep :) if you can make a failing example that would be best.
On Aug 12, 2014 8:48 AM, "Florent Cailhol" notifications@github.com wrote:

Should I open a new issue?


Reply to this email directly or view it on GitHub
#153 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants