@erickmerchant/framework
Advanced tools
Comparing version 12.1.0 to 12.1.1
{ | ||
"name": "@erickmerchant/framework", | ||
"version": "12.1.0", | ||
"version": "12.1.1", | ||
"description": "A simple data down, actions up framework.", | ||
@@ -23,7 +23,7 @@ "main": "main.js", | ||
"mockery": "^2.1.0", | ||
"nyc": "^11.0.3", | ||
"standard": "^10.0.0", | ||
"tape": "^4.7.0" | ||
"nyc": "^11.2.0", | ||
"standard": "^10.0.3", | ||
"tape": "^4.8.0" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -22,4 +22,9 @@ # @erickmerchant/framework | ||
switch (action) { | ||
case 'increment': commit((state) => state + 1) | ||
case 'decrement': commit((state) => state - 1) | ||
case 'increment': | ||
commit((state) => state + 1) | ||
break | ||
case 'decrement': | ||
commit((state) => state - 1) | ||
break | ||
} | ||
@@ -33,13 +38,5 @@ } | ||
<br> | ||
<button onclick=${decrement}>--</button> | ||
<button onclick=${increment}>++</button> | ||
<button onclick=${() => dispatch('decrement')}>--</button> | ||
<button onclick=${() => dispatch('increment')}>++</button> | ||
</main>` | ||
function decrement () { | ||
dispatch('decrement') | ||
} | ||
function increment () { | ||
dispatch('increment') | ||
} | ||
} | ||
@@ -73,8 +70,11 @@ ``` | ||
_seed(state)_ | ||
_seed(state|setup)_ | ||
It should be passed the initial state | ||
It should be passed the initial state or a setup function | ||
- [state](#state): the initial state | ||
- [setup](#setup): a function to generate the initial state | ||
_Warning: Calling seed after [init](#init) is called will throw an Error_ | ||
#### commit | ||
@@ -89,2 +89,4 @@ | ||
_Warning: Calling commit before [init](#init) is called will throw an Error_ | ||
#### dispatch | ||
@@ -94,3 +96,3 @@ | ||
Initializes a change in state and causes a render | ||
Initializes a change in state and causes a render. If the length of arguments is 0, the agent is not, but a render is triggered. | ||
@@ -103,3 +105,3 @@ - arguments: all get passed to the [agent](#agent) | ||
A convenient helper to pass a callback to process.nextTick. Can be used to manipulate the page in some way after a render. For example scrolling to a specific element | ||
A convenient helper to pass a callback to process.nextTick. Can be used to manipulate the page in some way after a render. For example scrolling to a specific element or focusing an input element. | ||
@@ -113,3 +115,3 @@ - target: the target passed to [framework](#framework) | ||
Call init to mount your component. The callback is optional. | ||
Call init to mount your component. The callback is optional. | ||
@@ -129,2 +131,10 @@ - target: the target passed to [framework](#framework) | ||
#### setup | ||
_setup(commit)_ | ||
It should return the initial state. | ||
- [commit](#commit) | ||
#### agent | ||
@@ -159,6 +169,2 @@ | ||
- [@erickmerchant/combine-stores](https://github.com/erickmerchant/combine-stores) | ||
A module to create a store from other stores where each is responsible for one property in the state. __Does not currently work with 12__. | ||
- [@erickmerchant/router](https://github.com/erickmerchant/router) | ||
@@ -165,0 +171,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9055
168
5