Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set global variables in a file - not in conf file #36

Open
fabbsc opened this issue Mar 9, 2017 · 3 comments
Open

set global variables in a file - not in conf file #36

fabbsc opened this issue Mar 9, 2017 · 3 comments

Comments

@fabbsc
Copy link

fabbsc commented Mar 9, 2017

currently global variables are being set in
onPrepare: function () {
global.myFirstVar = 1;
},

I have about 30 variables, and the conf file it's starting to get a bit messy. It would be a bit more organised if we could link the global variables directly in a file.

@robinj
Copy link
Collaborator

robinj commented Mar 9, 2017

Is this a proposal for a new rule in the style guide?

@fabbsc
Copy link
Author

fabbsc commented Mar 10, 2017

Yes, it is. I am storing global variables as arrays, found a slightly better approach, but in my opinion it would result in a much clearer conf file.

Currently, I am storing value like this:

onPrepare: function () { global.priceA = { "price1": 11 }, global.priceB = { "price1": 71 };

And I have about 60 global variables, so far.
My suggestion is to save all the global variables to a different file. For example, reference it.

@fabianclain
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants