General developer forum

Global function in AMD module?

Picture of Justin Hunt
Re: Global function in AMD module?
Particularly helpful MoodlersPlugin developers

You would declare it is a dependency of your other script. And then it would be loaded in time and available for you to use:


define(['jquery','block_myblock/myscript'], function($,myscript) {
    return {
        init: function() {
If you wanted to load it from a non AMD module, then life gets hard, and its going the wrong direction. 
Average of ratings: -