Created
January 29, 2014 12:03
-
-
Save lennym/8686578 to your computer and use it in GitHub Desktop.
Ractive.JS ideas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var user = { | |
| name: 'Mike', | |
| points: 1 | |
| }; | |
| var ractive1 = new Ractive({ | |
| el: 'container', | |
| template: '#template', | |
| data: user | |
| }); | |
| var ractive2 = new Ractive({ | |
| el: 'anothercontainer', | |
| template: '#anothertemplate', | |
| data: user | |
| }); | |
| user.points = 1; | |
| /** THOUGHTS ** | |
| * Would this update both elements, or do I need to ractive1.set(...); ractive2.set(...)? | |
| * Assuming the answer to the above is no, is there any way I can have all views/templates | |
| that depend on a data object update without having to call them all individually? | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lennym - came across this via the Twitter conversation (I was CC'd at one point, or at least my alter ego @ractivejs was).
As @mikemaccana noticed,
user.points = 2didn't work. It does now, in the latest development builds. 'Magic mode' is really just another adaptor - if you had several Ractive views that shared a (for example) Backbone model, you could synchronise them all by using the Backbone adaptor, if you wanted to use that (plus the other features of Backbone models) rather than POJOs and ES5 magic.