acebase/dist/browser.html
Ewout Stortenbeker d2dcae8317 browser support!
2019-12-06 15:08:56 +01:00

25 lines
No EOL
850 B
HTML

<html>
<head>
<script src="browser.min.js"></script>
</head>
<body>
<script>
// Create AceBase using localStorage
const db = new AceBase('mydb', { temp: false }); // Set temp to true to use sessionStorage instead of localStorage
db.ready(() => {
console.log('Database ready to use');
return db.ref('browser').set({
test: 'AceBase runs in the browser!'
})
.then(ref => {
console.log(`"${ref.path}" was saved!`);
return ref.get();
})
.then(snap => {
console.log(`Got "${snap.ref.path}" value:`);
console.log(snap.val());
})
})
</script>
</body>
</html>