Looking at the example in examples/quickstart2.js, I am wondering whether it would make sense if loki passed the db as parameter? Such that:
// We will use autoload (one time load at instantiation), and autosave with 4 sec interval.
var db = new loki('quickstart2.db', {
autoload: true,
autoloadCallback : databaseInitialize,
autosave: true,
autosaveInterval: 4000 // save every four seconds for our example
});
// implement the autoloadback referenced in loki constructor
function databaseInitialize(db) {
// on the first load of (non-existent database), we will have no collections so we can
// detect the absence of our collections and add (and configure) them now.
var entries = db.getCollection("entries");
if (entries === null) {
entries = db.addCollection("entries");
}
// kick off any program logic or start listening to external events
runProgramLogic();
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Looking at the example in
examples/quickstart2.js
, I am wondering whether it would make sense if loki passed the db as parameter? Such that: