Skip to content

Lightweight, powerful & framework-agnostic JavaScript state management in less than 1.5KB!

License

Notifications You must be signed in to change notification settings

jlndk/ObservableList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ObservableList

Lightweight, powerful & framework-agnostic JavaScript state management in less than 1.5KB!

ObservableList is a simple, but flexible way of storing data in Single Page Applications, based on the paradigm of stores, presented by Svelte. The goal is to make it as simple to work with arrays as with primitive data-types, such as integers, booleans and strings, while still offering reactivity, persistance and sharability between application components.

Also includes helper for syncronising data with LocalStorage.

Demo

@TODO

Installing

The package can be installed with NPM or Yarn.

Yarn

yarn add @jlndk/ObservableList

NPM

npm install @jlndk/ObservableList

Usage

See Wiki.

TL;DR:

import {list} from '@jlndk/observable-list';
const list = list(); // or list(["initial", "values"]);
const unsubscribe = list.subscribe(updatedList => {
    //Do what you want with updated list...
    console.log(updatedList[0]); //new value
});
list.push("new value");

Notice: Make sure to call the unsubscribe method when your component is destroyed to prevent memory leaks.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Tests

@TODO

About

Lightweight, powerful & framework-agnostic JavaScript state management in less than 1.5KB!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages