I know how to write Meteor packages but I can\'t seem to figure out how to have all exports land in my app\'s namespace, as described in this presentation.
This particul
The api.export
method is only supported for top-level variables right now. It doesn't work for nested variables, because "it turned out that using deep exports was
very confusing", and what would you expect MyApp.myMethod
to appear as in the global namespace if you also exported MyApp.myOtherMethod
?
You should just export MyPackage
, and then call MyPackage.myMethod()
. A common approach is to do something like
MyPackage = {
myMethod: someSecretMethodName,
myOtherMethod: otherMethodName
}
And then call api.export("MyPackage")
. This means that the exported names of variables don't necessarily have to be what you called them. This is used a lot in the core meteor packages; you can also see an example at for MongoInternals in mongo_driver.js.