Standards for including an outside javascript plugin (in this case --> intro.js)


#1

Greetings fellow meteorites!
In the process of installing an outside js plugin called intro.js https://github.com/usablica/intro.js Acc. to the install instructions, the only files needed are intro.js and introjs.css and then a introJs().start(); call can be made.

So… here is my environment setup.

  1. The official jquery meteor package is installed https://atmospherejs.com/meteor/jquery

  2. intro.js file is inside a client/lib/js directory.

  3. introjs.css file is inside a client/lib/stylesheets/ directory

  4. since the js will span multiple pages my call is in body.onRendered like so

    Template.body.onRendered(function () {
    introJs().start();
    });

This function without delay doesn’t work but with delay like so

Template.body.onRendered(function () {
  setTimeout(function() { introJs().start(); }, 5000);
});

IT WORKS!

Does anyone have any suggestions on how to fix this problem without a timeout? Perhaps restructuring my directories ? Perhaps using a different hook ?

Thanks and look forward to the response!
Alex