How can I add third-party JavaScript libraries to a Meteor application?

后端 未结 4 1907
说谎
说谎 2020-12-01 00:40

I want to add a JavaScript front-end plugin, like jquery.center.js, to a Meteor app.

If I put it in my app/ directory and refresh the page

4条回答
  •  [愿得一人]
    2020-12-01 01:27

    One way to do this in MeterorJS 1.3.x

    Add the JS files in the public\js\ directory

    Load it up from Meteor.startup method using $.getScript in client/main.js If you want to control script load sequence, control with multiple $.getScript for each js files.

    Meteor.startup(function(){
        $.getScript('js/fhir-client.js', function(){
            // script should be loaded and do something with it. 
    
        });
    });
    

提交回复
热议问题