Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 643 Bytes

browser.md

File metadata and controls

19 lines (15 loc) · 643 Bytes

StormDB can be used within the browser, by importing the necessary code using a CDN and using the StormDB browser engine. The data will be stored in the localStorage of the browser.

<!-- import code using CDN -->
<script src="https://unpkg.com/stormdb/dist/StormDB.min.js"></script>
<script src="https://unpkg.com/stormdb/dist/BrowserEngine.min.js"></script>

<script>
  // start DB with browser engine
  const engine = new BrowserEngine("db");
  const db = StormDB(engine);

  // set default value for empty database
  db.default({ name: "tom" });

  // output name in database
  console.log(db.get("name").value());
</script>