[Newbie question]: How to access a global variable within a package?


#1

Hi guys,

playing around a bit with velocity & jasmine I decided to create my first local-package containing the fixtures under /packages/fixtures.

The thing is that I got certain variables (for roles and permissions) under standard /lib/roles.js that I need to access within my fixtures-package in order to keep it DRY.

Is this possible at all? Can I make global variables accesseble within a local-package?

Background: For now I decided to keep my files organized the standard-meteor way and DO NOT want to put all my code into seperate local-packages (which would make this usecase possible, as I could just add my (non-existing) roles-package to api.use within fixtures.


#2

shooting from the hip here, but global variables should be available in Meteor.startup(). Do you get any errors? Also if it’s a package variable you need then you have to api.use() the package first.


#3

@KristerV: thanks for your tip.

I actually went on yesterday and started changing the whole project structure to an all-in-packages approach.
I ran into some new problems, but solved this one as I can now easily include/export variables and share them between packages I need. :smile:

Thanks for your help! :smiley: