Questo è un po 'in ritardo ma ho trovato una soluzione; almeno nel contesto del mio attuale progetto.
Sto implementando D3 con Meteor e volevo una funzionalità di zoom personalizzata che modificasse le dimensioni del modello quando l'utente scorre.
Creare un reattivo variabile 'zoom'
Template.graph.onCreated(function() {
var self = this;
self.zoom = new ReactiveVar(0);
$(window).on('scroll', function(e) {
// ... event processing stuff;
// say it produces value 'zoomAmount' ...
self.zoom.set(zoomAmount);
}
});
Creare un aiutante che restituisce zoom. Riferiscilo nel template DOM in un elemento nascosto per renderlo reattivo.
Template.graph.helpers({
zoom: function() {
// This will be called when 'zoom' changes,
// so treat this as your events function
return Template.instance().zoom.get();
}
});
fonte
2015-05-19 00:58:22
per quanto posso dire nulla è cambiato su questo: https://github.com/meteor/meteor/issues/3298 – Aaron