Have been trying to run the clock example stand alone, these are my (slightly modified) files:
Ractive clock demo
// main.js -> create our clock...
var baseView;
Ractive.load( 'baseView.html' ).then( function ( BaseView ) {
baseView = new BaseView({
el: 'main',
data: { datetime: new Date()}
})
});
var i= 0;
setInterval(function () {
if (i%2 == 0) console.log("tick");
else console.log("tack");
i++;
baseView.set('datetime', new Date() );
}, 1000);
baseView.html and clock.html unmodified (except for not using a Capital letter in front)
All the below will be obvious to you, but it took me a lot of time to figure out ->
issue: can you add this to the doc, so people do not have to guess/dig how it is done standalone without the Gist?
issue: I was reading about in https://github.com/ractivejs/ractive-load and tried to use variations of Ractive.load.modules.moment = moment, but in vain. Finally I just loaded it (i.e. the nodeJs-module moment) in index.html along with ractive.js. That worked! But why then "Ractive.load.modules"? Please explain and document how it should be done in my example or else which you can run stand-alone.
Hi!
Have been trying to run the clock example stand alone, these are my (slightly modified) files:
// main.js -> create our clock... var baseView; Ractive.load( 'baseView.html' ).then( function ( BaseView ) { baseView = new BaseView({ el: 'main', data: { datetime: new Date()} }) });
var i= 0; setInterval(function () { if (i%2 == 0) console.log("tick"); else console.log("tack"); i++; baseView.set('datetime', new Date() ); }, 1000);
baseView.html and clock.html unmodified (except for not using a Capital letter in front)
All the below will be obvious to you, but it took me a lot of time to figure out ->
Otherwise great work! Thanks!!!