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

Electron error #168

Open
rumkin opened this issue May 30, 2016 · 11 comments
Open

Electron error #168

rumkin opened this issue May 30, 2016 · 11 comments

Comments

@rumkin
Copy link

rumkin commented May 30, 2016

Electron node.js application has both module.exports and window variables and thus alight get into module.exports instead of window variable.

@lega911
Copy link
Owner

lega911 commented May 30, 2016

it's ok, when amd/commonjs is available, then alight works via "require" instead of put it to window

@rumkin
Copy link
Author

rumkin commented May 30, 2016

But it's not ok in electron browser.

@lega911
Copy link
Owner

lega911 commented May 30, 2016

why? you can do: window.alight = require('alight')

@rumkin
Copy link
Author

rumkin commented May 30, 2016

Because I'm using it as a client library for ui and load it from bower component directory with <script>.

@lega911
Copy link
Owner

lega911 commented May 30, 2016

some developers use requirejs for client libraries, and window shouldn't be spoiled.
method "require" is available for you?
is ok if you will use function "alightInitCallback" to receive alight?

@rumkin
Copy link
Author

rumkin commented May 31, 2016

I've tried alightInitCallback but with no success. Now I'm using require method. But I think It should be solved somehow or clarified in the doc.

@lega911
Copy link
Owner

lega911 commented May 31, 2016

I've tried alightInitCallback but with no success.

I increased priority for "alightInitCallback", now it will test before define/require.

But I think It should be solved

I will add it to FAQ, if you have idea how to fix it, tell me (problem: if requirejs is used, then global alight shouldn't be created)
as version, if "window.alightInitCallback === true", then alight works as default

@rumkin
Copy link
Author

rumkin commented Jun 1, 2016

I think it should be detected define function from requirejs.

@lega911
Copy link
Owner

lega911 commented Jun 1, 2016

@rumkin
Copy link
Author

rumkin commented Jun 1, 2016

So we have wrong behaviour in atom when module.exports is presented. It could be solved with comparing global or window with this.

Code duplication found https://github.com/lega911/angular-light/blob/master/src/js/postfix.js#L16

@lega911
Copy link
Owner

lega911 commented Jun 3, 2016

what do you propose?
if(this != window) window.alight = alight; or if(typeof(global) !== 'undefined') window.alight = ...

Code duplication found

yes, thank you, I had fixed it

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

No branches or pull requests

2 participants