CRUD.js
CRUD.js copied to clipboard
The Database object does not seem to be exported correctly
When I try to use the lib I only get a Uncaught ReferenceError: Database is not defined
.
Here's a pen to illustrate where I've inlined your script and then added the example from the README. http://codepen.io/davidpaulsson/pen/KdJJGQ
I discussed this with @valeriangalliat last night and his advice would be to use CRUD.js in a file, the usual, and then browserify than file in a single bundle that should be included in a page. The reason behind this is that in theory, browserify is not supposed to define globals.
So for a project that does not have a browserify build step, CRUD.js is out of the question?
Not entirely sure to be honest. Maybe let’s hear from @valeriangalliat when he’s up. :)
in theory, browserify is not supposed to define globals.
I mean, I wouldn't be surprised if Browserify had an option to export a module as a global in the bundle. But the way I've always used Browserify was by having my own main.js
requiring other modules. This way I bundle my main.js
and everything comes packaged and self contained without any global.
We could look at how WebTorrent handles this, since they use Browserify and still provide a standalone file defining a global for users not willing to use Browserify. Looks like this command is doing the magic.
So that's the thing you want to add to CRUD.js to support exporting a global. But yep I believe the current dist/CRUD.min.js
is useless right now since not exposing anything.