javascript - Ractive expressions not working after a reset() -


My team is currently using Reactive to show a series of alerts every warning:

  • Offers a view with Reactive
  • Start Twitters widgets.js which manipulate DOM (to embed tweets)
  • < Li> later changes the data in that view (when the user selects a different alert)

Since the domain of the reactiv in the domain of Twitter Virtual Dome interferes, we currently use to reset dow after Twitter widgets.js ends - reset () to a whole bunch of DOM problems Prevents like Can not add a null child which may be because Twitter has tampered with it Dome behind the back of Reactive.

However, after we run, ractive.reset () expressions now work.

Is this the right way to handle other libraries that manipulate the DOM? How can I continue to express the expression after reset ()

? Here's a quick demo - note that the expression works before reset () but not later:

  & lt; Body & gt; & Lt; H1 & gt; Trial & lt; / H1> & Lt; Div class = "bound" & gt; & Lt; / Div & gt; & Lt; Script src = 'http: //cdn.ractivejs.org/latest/ractive.js'> & Lt; / Script & gt; & Lt; Script & gt; Var Binding = New Reactive ({L: document.querySelector ('binding'), data: {name: 'mike', swaggify: function (string) {return 'SWAG' + string}}, template: '& lt; p & Gt; Hello, {{swaggify (name)}} & lt; / p & gt; '}) binding .set (). Then (function () {binding.data.name = 'steve'}) & lt; / Script & gt; & Lt; / Body & gt;  

and

when you call ractive reset () , it changes the data object - in this case, which contains the swaggify function if you put it back, then it works fine

(Note that I have code binding.set () immediately followed by the code - the change is synchronously, .then () Simply schedule a function to complete a change This is the promise / A + compliant, so inside the code, .then () is always asynchronous - in some cases which can cause flicker, so sync> Ascend wherever possible .)

It is not possible that what you want - you want to be able to deal with data and formats differently, a good method to format the formatting prototype data Put that which is un If all these are missing:

  var helpers = Ractive.defaults.data; // Ractive.defaults === Ractive.prototype helpers.swaggify = function (string) {return 'SWAG' + string}; Var Binding = New Reactive ({L: document.querySelector ('binding'), data: {name: 'mike', swaggify: function (string) {return 'SWAG' + string}}, template: '& lt; p & Gt;   

Demo of this approach is here:. {

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -