-
Notifications
You must be signed in to change notification settings - Fork 5
Modules and Applications
Dominik Guzei edited this page May 29, 2015
·
1 revision
Instead of globally accessing Meteor packages in your codebase you can add them to your module / application dependencies and have them injected automatically after initialisation.
Space.Application.create({
Dependencies: {
meteor: 'Meteor',
tracker: 'Tracker',
ejson: 'EJSON',
ddp: 'DDP',
accounts: 'Accounts',
random: 'Random',
underscore: 'underscore',
reactiveVar: 'ReactiveVar',
mongo: 'Mongo'
},
configure: function() {
expect(this.meteor).to.equal(Meteor);
expect(this.tracker).to.equal(Tracker);
expect(this.ejson).to.equal(EJSON);
expect(this.ddp).to.equal(DDP);
expect(this.accounts).to.equal(Package['accounts-base'].Accounts);
expect(this.random).to.equal(Random);
expect(this.underscore).to.equal(_);
expect(this.reactiveVar).to.be.instanceof(Package['reactive-var'].ReactiveVar);
expect(this.mongo).to.equal(Mongo);
}
});Space.Application.create({
Dependencies: {
templates: 'Template',
session: 'Session',
blaze: 'Blaze',
},
configure: function() {
expect(this.templates).to.equal(Template);
expect(this.session).to.equal(Session);
expect(this.blaze).to.equal(Blaze);
}
});Space.Application.create({
Dependencies: {
email: 'Email',
process: 'process',
Future: 'Future',
},
configure: function() {
expect(this.email).to.equal(Package['email'].Email);
expect(this.process).to.equal(process);
expect(this.Future).to.equal(Npm.require('fibers/future'));
}
});