node-easel icon indicating copy to clipboard operation
node-easel copied to clipboard

Global variable

Open maciek134 opened this issue 11 years ago • 3 comments

The way the library works now is wrong. It should not create a global createjs variable, it should return it's contents as all of Node's modules do (using module.exports), to avoid polluting the global namespace (even if there is only this one variable working as a namespace, this is not the Node way to do things). I understand, that you want to make the usage as close to the browser as possible, but this one thing should be changed.

#EDIT Apparently the variable was exported in the 1a35f0f commit, but it's not there anymore.

maciek134 avatar Dec 29 '13 16:12 maciek134

It wasn't really about keeping usage the same as the browser, it was about making future updates painless. Porting EaselJS to a proper node module was just not feasible. Since there is a lot of internal Easel code that depends on having that global createjs namespace (and a handful of browser classes as well). But this is something I'll be looking into for the future, once Easel is at a more stable state.

wdamien avatar Jan 04 '14 19:01 wdamien

the global namespace is used by everything, including Node.. Relax and drink a glass of wine.

hayesmaker avatar Mar 12 '15 00:03 hayesmaker

@hayesmaker I hope you didn't authored any Node.js modules if that's how you think. None of the good modules I know create or use any kind of global namespace, and even if there was some that do it doesn't change the fact that anything global is wrong.

maciek134 avatar Mar 12 '15 08:03 maciek134