-
Notifications
You must be signed in to change notification settings - Fork 715
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
Export sqlitePlugin object #382
Comments
If you are ok, I can send in a pull request for this. |
Thanks @axemclion. I still have to think about this a little. While a pull request is always welcome, your description with the Suggestion solution above is clear enough. Assuming I do include this I will be sure to give you the credit for the fix (along with the change to the CoffeeScript version to keep it up-to-date). |
Also, I really like your react-native-cordova-plugin project and wish I had found it earlier. I will add a link to README.md when I get a chance. I suggest that you do not close axemclion/react-native-cordova-plugin#4 until we get this fixed. The one thing I have against this change is that there are a couple of cases where I will need to support using SQLitePlugin.js outside of the Cordova framework. One example that I am working on is using the plugin from a web worker, where I really cannot use cordova.js and have to build another Javascript-native communication system. I am planning to make a separate version to support some other extra features and am thinking about including the suggested solution there instead. |
@brodybits I think that one solution could be to have all the core logic in one file, say SQLitePlugin.js, and then have adapters, once for webworkers, another for Cordova, etc. This way most of the logic will still be shared, and cordova specific parts are simply moved to a specific file. |
Update for @andpor/react-native-sqlite-storage also working for Android ref: storesafe#382
Update for @andpor/react-native-sqlite-storage also working for Android ref: storesafe#382
Update for @andpor/react-native-sqlite-storage also working for Android ref: storesafe#382
@axemclion I would like to hold off on this for now. It would need some tweaking to work in a web worker, and also the suggested solution did not really work for me. There is now https://github.com/andpor/react-native-sqlite-storage that ports this project to React Native and I will recommend this in axemclion/react-native-cordova-plugin#4. I am thinking to follow the advice in http://blog.vjeux.com/2011/javascript/javascript-one-line-global-export.html when I get around to this unless I find a better idea. |
The www folder currently assigns
sqlitePlugin
object toroot
here.root
is assigned tothis
, which happens to bewindow
in case of Cordova, and so the plugin currently works.However, cordova plugins require a module.exports so that the clobbers specified in plugin.xml works.
Suggested solution - add
module.exports = root.sqlitePlugin
at the end of the function here.This error surfaced, when this plugin was used in ReactNative (example) using the react-native-plugin-adapter.
Tracked in this issue - axemclion/react-native-cordova-plugin#4
The text was updated successfully, but these errors were encountered: