call functions from separate files with Meteor

Using a globally defined variable, as avital suggests, will work, but is not a recommended code design choice (see JS mistake 1 listed here).

Instead in your lib directory you could create a file with:

Meteor.myFunctions = {
...
    makeBoard : function() { ... },
...
}

Then in any other js file you could call Meteor.myFunctions.makeBoard(). This should be done in the lib directory because Meteor guarantees the js files in lib are loaded before other directories, so your function will already be loaded.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)