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

Init erro by node-webkit context #54

Closed
zhaoxingyun opened this issue Jan 7, 2015 · 1 comment
Closed

Init erro by node-webkit context #54

zhaoxingyun opened this issue Jan 7, 2015 · 1 comment

Comments

@zhaoxingyun
Copy link

use node-webkit.

var db = new loki();

will throw error

Uncaught node.js Error 

ReferenceError: document is not defined
    at Loki.getENV (D:\workspace\radium\canvas\node_modules\lokijs\src\lokijs.js:228:15)
    at LokiEventEmitter.Loki (D:\workspace\radium\canvas\node_modules\lokijs\src\lokijs.js:237:18)

change source code in file lokijs.js:224 like this will be ok

   if (typeof exports === 'object' || typeof window === 'undefined') {
@techfort
Copy link
Owner

techfort commented Jan 7, 2015

I am going to change the db constructor so that it takes (among others) the option 'env', so environment can be set explicitly skipping detection. So you would do var db = new loki('myApp', { env: 'NODEJS' })

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