Skip to content

Instantly share code, notes, and snippets.

@sebm
Last active November 20, 2016 04:26
Show Gist options
  • Save sebm/92301a9954b031a37e3da2d461cbc8fb to your computer and use it in GitHub Desktop.
Save sebm/92301a9954b031a37e3da2d461cbc8fb to your computer and use it in GitHub Desktop.
I can't figure out nedb!
- clone this gist
- open index.html in browser
- observe an exception is thrown
<!DOCTYPE html>
<html>
<head>
<title>Nedb in-browser test</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nedb/1.8.0/nedb.min.js"></script>
</head>
<body>
<script>
var db = new Nedb({filename: 'urls.db', autoload: true});
db.find({}, (err, docs) => {
if (docs.length !== 1) {
throw "No docs found";
}
});
</script>
</body>
</html>
{"url":"https://google.com","visited":false,"_id":"jHZ10oRyx7WdOBjm"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment