Comparing version 2.0.11 to 2.0.12
66
index.js
@@ -60,3 +60,3 @@ var SSR_NODE = 1 | ||
newSub[1], | ||
(oldSub && oldSub[2](), newSub[0](dispatch, newSub[1])) | ||
(oldSub && oldSub[2](), newSub[0](dispatch, newSub[1])), | ||
] | ||
@@ -358,3 +358,3 @@ : oldSub | ||
type, | ||
node | ||
node, | ||
}) | ||
@@ -370,10 +370,13 @@ | ||
export var app = (props) => { | ||
var view = props.view | ||
var node = props.node | ||
var subscriptions = props.subscriptions | ||
export var app = ({ | ||
init = EMPTY_OBJ, | ||
view, | ||
subscriptions, | ||
dispatch = id, | ||
node, | ||
}) => { | ||
var vdom = node && recycleNode(node) | ||
var subs = [] | ||
var doing | ||
var state | ||
var busy | ||
@@ -386,27 +389,6 @@ var setState = (newState) => { | ||
} | ||
if (view && !doing) enqueue(render, (doing = true)) | ||
if (view && !busy) enqueue(render, (busy = true)) | ||
} | ||
} | ||
var dispatch = (props.middleware || id)((action, props) => | ||
typeof action === "function" | ||
? dispatch(action(state, props)) | ||
: isArray(action) | ||
? typeof action[0] === "function" | ||
? dispatch(action[0], action[1]) | ||
: action | ||
.slice(1) | ||
.map( | ||
(fx) => fx && fx !== true && fx[0](dispatch, fx[1]), | ||
setState(action[0]) | ||
) | ||
: action == null | ||
? patchSubs(subs, EMPTY_ARR, (dispatch = id)) | ||
: setState(action) | ||
) | ||
var listener = function (event) { | ||
dispatch(this.events[event.type], event) | ||
} | ||
var render = () => | ||
@@ -419,6 +401,28 @@ (node = patch( | ||
listener, | ||
(doing = false) | ||
(busy = false) | ||
)) | ||
return dispatch(props.init), dispatch | ||
var listener = function (event) { | ||
dispatch(this.events[event.type], event) | ||
} | ||
return ( | ||
(dispatch = dispatch((action, props) => | ||
typeof action === "function" | ||
? dispatch(action(state, props)) | ||
: isArray(action) | ||
? typeof action[0] === "function" | ||
? dispatch(action[0], action[1]) | ||
: action | ||
.slice(1) | ||
.map( | ||
(fx) => fx && fx !== true && fx[0](dispatch, fx[1]), | ||
setState(action[0]) | ||
) | ||
: action == null | ||
? patchSubs(subs, EMPTY_ARR, (dispatch = id)) | ||
: setState(action) | ||
))(init), | ||
dispatch | ||
) | ||
} |
{ | ||
"name": "hyperapp", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
379
19228