-
-
Notifications
You must be signed in to change notification settings - Fork 595
Enhancement: Allow Electron to use browser version of Parse JS SDK. #193
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
Comments
@typhonrt we're considering a more verbose initialization API, as seen here: parse-community/Parse-SDK-iOS-OSX#570 |
I was able to solve this, but only for backbone-parse-es6. I provide a helper module to init parse from a config file with typhonjs-core-parse-init. By changing this to CJS from ES6 I am able to manipulate CoreManager before Parse is imported / required. That certainly is a cool feature of JSPM / SystemJS insofar that you can selectively load modules as any type and even in a 99.9% ES6 codebase pull in a CJS module to get around ES6 hoisted imports when necessary. So folks who want to see an Electron demo w/ Parse & Backbone check out: electron-backbone-parse-es6-todos-improved. Perhaps the general solution for Parse is moving this CoreManager access in ParseObject to the Parse.initialize method. In ParseUser instead of setting a module private variable perhaps directly access Parse.CoreManager.get('IS_NODE') where canUseCurrentUser is used. While I have your attention @andrewimm could you please comment on the outstanding deserialization issue that I'm waiting on for your response. I've outlined a solution in #144 |
Resolved in 1.7.1 |
Sounds good @andrewimm ! Do take a look at the solution I outlined in #144 If that is agreeable to you and you'll timely review a PR I'll make the changes. |
@andrewimm
I am now supporting easy integration w/ Electron for backbone-parse-es6 via JSPM / SystemJS and typhonjs-core-gulptasks. An Electron desktop demo version of the canonical TODOS app is available via electron-backbone-parse-es6-todos-improved.
Since Electron is a hybrid Node / browser environment Parse thinks it's running in Node though it can run perfectly fine in browser mode in Electron.
In CoreManager
config.IS_NODE
is set here on lines 113-115If one changes this to the following then Parse will run in browser mode in Electron:
Everything else works after that. I can't see a way of setting IS_NODE to false before ParseUser and ParseObject set module private variables based on IS_NODE. This occurs on import of
Parse
before any chance to invoke the API or accessParse.CoreManager
is possible. IE one can't callParse.CoreManager.set('IS_NODE', false);
before affected areas of code run.Can you recommend a way forward for allowing Parse to run in browser mode in Electron?
The text was updated successfully, but these errors were encountered: