Giter Club home page Giter Club logo

sixe's Introduction

SIXE

Lightweight State Management Library for Angular, React, Vue and others

SIXE

SIXE is a global state management tool built on top of typescript, that helps your client application manage its state regardless of the web framework/library you use,

Features

  • Works on top of any frontend typescript framework/library
  • State is outside main thread - runs in seperate thread for Performace
  • Maintains State aross tabs and windows - state managed in shared worker
  • Lightweight - Low unpack size
  • No dependencies

Tech

  • [ Typescript ] - Built on top of Typescript
  • [ Shared Worker ] - Shared worker is used to maintain state

Checkout SIXE's Git Repo - [public repository] on GitHub.

Usage

/* to initialize the service Appname is optional */
var stateService = new SixeStateService('AppName');

/* to set/update state */
this.stateService.setState({
  name: 'sixe',
  data : ['grapes', 'tomato']
});

/* to listen to events that changes the state */
stateService.sixe.onmessage = (event:any) => {
    let state = event?.data;
    console.log(state)
};

/* 
 once all browsers for this SPA (connections) are closed 
 inside window event listener 'beforeunload'
*/
  if (!this.state || this.state.connections == 1) stateService.close();

Note :

  • Angular users might need to run NgZone inside onmessage event function to get their state properly,
  • others can use their reactive variables to save/use the state you get from onmessage event function.

Examples (Angular ,React, Vue)

https://stackblitz.com/@BruceArmstrong007/collections/sixe-typescript-state-management-tool

Example in Angular - https://github.com/BruceArmstrong007/SIXE-Example-Angular-

Installation

to Install SIXE

npm i sixe 
or
npm i sixe@latest

Support

  • All major desktop browers - Chrome, Edge, Firefox, Opera, Safari
  • Few mobile browsers - Firefox for Android, Safari on iOS

For more details visit mdn web docs

License

MIT

Issues

Raise issues here - github/issues

Image for multi window state management

image

sixe's People

Contributors

brucearmstrong007 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.