@nathanfaucett/atom

0.0.2 • Public • Published

Atom

clojure like atom for the browser and node.js

var Atom = require("@nathanfaucett/atom");


var atom = Atom({
  key: null
});

atom.addListener(function onChange(prev, next) {
  // use prev and next state
});

atom.update(function update(current) {
  return {
    key: "value"
  }
});
console.log(atom.get()); // { key: "value" }

atom.set({
  key: null
});
console.log(atom.get()); // { key: null }

Readme

Keywords

Package Sidebar

Install

npm i @nathanfaucett/atom

Weekly Downloads

2

Version

0.0.2

License

BSD-2-Clause

Last publish

Collaborators

  • nathanfaucett