Notes for Meteor 0.9.x
This package is now called amd:manager
.
meteor-amd-manager
This package provides AMDManager
class that allows you to implement your own define/require
module management routines.
Installation
Simply type
meteor add amd:manager
and you're good to go.
Usage
As an example, lets implement the standard define/reqire
pair. This could be done more like this:
var manager = { var readyDep isReady; if _ if !_ listOrName = listOrName ; return manager; if _ return manager; throw 'Wrong parameters for require.';} { if argumentslength == 2 body = deps; deps = ; manager;} defineamd = {};
Methods
The only non-obvious methods of the manager are:
onModuleNotFound
which allows you to define a callback to be called every time should the user request a module that has not been defined yet. You can use it to decide if there is a need to download additional source code from the server.onModuleAlreadyDefined
which is called when a module is trying to be defined with the same name as an already defined module. You can use it to display a warning or throw an error.