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

clock example and require('moment') #31

Open
lutzbickhardt opened this issue Sep 11, 2015 · 1 comment
Open

clock example and require('moment') #31

lutzbickhardt opened this issue Sep 11, 2015 · 1 comment

Comments

@lutzbickhardt
Copy link

Hi!

Have been trying to run the clock example stand alone, these are my (slightly modified) files:

<title>Ractive clock demo</title> <script src='ractive.js'></script> <script src='ractive-load.js'></script> <script src='moment.js'></script> <script type="text/javascript" src="main.js"></script>

// 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 ->

  1. issue: can you add this to the doc, so people do not have to guess/dig how it is done standalone without the Gist?
  2. 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.

Otherwise great work! Thanks!!!

@lutzbickhardt
Copy link
Author

sorry, hope this works, index.html -> :

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

1 participant