Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easy-state

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-state - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

20

package.json
{
"name": "easy-state",
"version": "1.1.4",
"version": "1.1.5",
"description": "Simple state manipulation without any frameworks.",

@@ -13,7 +13,5 @@ "main": "./lib/index.js",

"dev": "webpack-dev-server --hot --inline --progress --colors --open",
"build":
"NODE_ENV=production cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"website": "cd docs && bundle exec jekyll serve",
"prettier":
"prettier --single-quote --write ./src/*.js && prettier --single-quote --write ./demo/*.js && prettier --single-quote --write ./__tests__/*.js"
"build": "NODE_ENV=production cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"deploy": "cd docs && gatsby build --prefix-paths && gh-pages -d public",
"prettier": "prettier --single-quote --write ./src/*.js && prettier --single-quote --write ./demo/*.js && prettier --single-quote --write ./__tests__/*.js"
},

@@ -24,3 +22,6 @@ "repository": {

},
"keywords": ["state", "state manipulation"],
"keywords": [
"state",
"state manipulation"
],
"jest": {

@@ -38,3 +39,5 @@ "coverageDirectory": "./coverage/",

"babel-register": "^6.24.1",
"codecov": "^2.3.0",
"cross-env": "^5.0.5",
"gh-pages": "^1.1.0",
"jest": "^20.0.4",

@@ -45,6 +48,5 @@ "jquery": "^3.2.1",

"webpack-dev-server": "^2.4.5",
"webpack-hot-middleware": "^2.18.0",
"codecov": "^2.3.0"
"webpack-hot-middleware": "^2.18.0"
},
"dependencies": {}
}

@@ -6,32 +6,6 @@ # Easy-state

## Getting started
First things first; import the module:
```js
import createStateTree from 'easy-state';
```
To get you started, initialize a state tree with the function `createStateTree`.
```js
const store = createStateTree({
counter: 1,
});
```
To retrieve the current state at any point in time, use `getState`:
```js
store.getState();
```
To alter any state from your state tree, use `setState`:
```js
store.setState({
counter: 2
});
```
Keep your UI in sync with your state by using `subscribe`:
```js
store.subscribe((prevState, nextState) => {
DOMElement.innerHTML = nextState.counter;
});
```
> To checkout some examples, visit the [docs page](https://oyvindhermansen.github.io/easy-state/)
## Visit the [docs page](https://oyvindhermansen.github.io/easy-state/)
---
### Developing easy-state

@@ -69,19 +43,13 @@

Website
Build for production
```sh
# make sure you have jekyll installed
# It will run on localhost:4000/easy-state/
$ yarn website
$ yarn build
```
Build for production
Run the website locally with Gatsby
```sh
$ yarn build
$ cd docs && yarn develop
```
### Motivation
I've often come across projects that needed to use plain jquery or vanilla JavaScript instead of any frameworks e.g React or VueJS, and there is one thing I've missed: Possibilty to have application state in sync with my UI without any hassle.
### Inspiration
The library is inspired by both React and Redux. It's sort of a Redux-lib, without the reducers, action-creators and dispatching actions, but instead changing state with setState()-method like they do in React.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc