@ccrpc/hash-manager
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Hash Manager

Store application state in the URL hash. Hash Manager is designed for use in Stencil components.

Usage

import { Component, Listen, Prop, Watch } from '@stencil/core';
import { hashManager } from '@ccrpc/hash-manager';

@Component({
  tag: 'person',
})
export class Person {
  @Prop() name: string = hashManager.init('name', 'Jane');

  @Listen('hashManagerChange', {target: 'window'})
  updateName(e: CustomEvent) {
    if (e.detail.old.name !== e.detail.new.name) this.name = e.detail.new.name;
  }
  
  @Watch('name')
  nameChanged() {
    hashManager.set('name', this.name);
  }
}

Credits

Hash Manager was developed by Matt Yoder for the Champaign County Regional Planning Commission.

License

Hash Manager is available under the terms of the BSD 3-clause license.

Readme

Keywords

none

Package Sidebar

Install

npm i @ccrpc/hash-manager

Weekly Downloads

5

Version

0.1.2

License

BSD-3-Clause

Unpacked Size

6.89 kB

Total Files

6

Last publish

Collaborators

  • ccrpc-fjunge
  • edmondklai
  • nodejl