const l = console.log.bind(this)
const _a = atom({ list: [1,2,3,4], bool: false, key: 'value' })
_a.subscribe(() => l(_a.get())) // will log the state on every change
_a.get('key') // 'value'
const { key } = _a.get() // key === { key: 'value' }
_a.set({ key: 'other value' })
_a.get() // { list: [1,2,3,4], bool: false, key: 'other value' }
_a.set((oldState) => ({ bool: !oldState.bool }))
_a.get() // { list: [1,2,3,4], bool: true, key: 'other value' }
_a.get('list').map(l)) // will log 1, 2, 3, 4
Production: https://s3-sa-east-1.amazonaws.com/camargo-public/atom/atom.min.js
Development: https://s3-sa-east-1.amazonaws.com/camargo-public/atom/atom.js