0.0.3 • Published 2 months ago

be-obsessing v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

be-obsessing

Read and update session storage (parsing via JSON).

NPM version How big is this package in your project? Playwright Tests

be-persisting, be-persistent, be-obsessing overlap quite a bit. They are all concerned with storing user data locally.

The differences in a nutshell:

be-obsessing (this package) focuses on storing data in session storage, and is configured primarily through "Hemingway notation" - complete English statements (including the name of the attribute).

be-persisting does the same, but focusing on indexedDB.

be-persistent works both with IndexedDB and Session Storage (and local storage), but is configured purely via JSON.

Example 1a:

<meta itemprop=myProp be-obsessing>

... reads JSON.parse(sessionStorage.getItem('myProp')). Same in reverse (but faster to set oMeta.beValueAdded.value = ...)

Watches for content property, and keeps in sync.

Example 1b:

<meta itemprop=myProp be-obsessing='about myStorage : my subsection.'>

... reads JSON.parse(sessionStorage.getItem('myStorage')).mySubsection and passes to content property. Same in reverse (but faster to set oMeta.beValueAdded.value = ...)

Watches for content property, and keeps in sync

Viewing Demos Locally

Any web server that can serve static files will do, but...

  1. Install git.
  2. Fork/clone this repo.
  3. Install node.js.
  4. Open command window to folder where you cloned this repo.
  5. npm install

  6. npm run serve

  7. Open http://localhost:3030/demo/ in a modern browser.

Running Tests

> npm run test

Using from ESM Module:

import 'be-obsessing/be-obsessing.js';

Using from CDN:

<script type=module crossorigin=anonymous>
    import 'https://esm.run/be-obsessing';
</script>