Comparing version 4.6.3 to 4.7.0
@@ -426,6 +426,6 @@ import { directive, render } from 'https://unpkg.com/lit-html@^1.0.0/lit-html.js'; | ||
const useReducer = hook(class extends Hook { | ||
constructor(id, state, _, initialState) { | ||
constructor(id, state, _, initialState, init) { | ||
super(id, state); | ||
this.dispatch = this.dispatch.bind(this); | ||
this.currentState = initialState; | ||
this.currentState = init !== undefined ? init(initialState) : initialState; | ||
} | ||
@@ -432,0 +432,0 @@ update(reducer) { |
declare type Reducer<S, A> = (state: S, action: A) => S; | ||
declare const useReducer: <S, A>(_: Reducer<S, A>, initialState: S) => readonly [S, (action: A) => void]; | ||
declare const useReducer: <S, I, A>(_: Reducer<S, A>, initialState: I, init?: ((_: I) => S) | undefined) => readonly [S, (action: A) => void]; | ||
export { useReducer }; |
import { hook, Hook } from './hook'; | ||
const useReducer = hook(class extends Hook { | ||
constructor(id, state, _, initialState) { | ||
constructor(id, state, _, initialState, init) { | ||
super(id, state); | ||
this.dispatch = this.dispatch.bind(this); | ||
this.currentState = initialState; | ||
this.currentState = init !== undefined ? init(initialState) : initialState; | ||
} | ||
@@ -8,0 +8,0 @@ update(reducer) { |
{ | ||
"name": "haunted", | ||
"version": "4.6.3", | ||
"version": "4.7.0", | ||
"description": "Hooks for web components", | ||
@@ -34,3 +34,3 @@ "main": "lib/haunted.js", | ||
"@matthewp/compile": "^2.4.3", | ||
"http-server": "^0.11.1", | ||
"http-server": "^0.12.0", | ||
"mocha-headless-chrome": "^2.0.3", | ||
@@ -37,0 +37,0 @@ "typescript": "^3.6.2" |
@@ -534,2 +534,7 @@ # Haunted 🦇 🎃 | ||
} | ||
disconnectedCallback() { | ||
super.disconnectedCallback(); | ||
this.hauntedState.teardown(); | ||
} | ||
} | ||
@@ -536,0 +541,0 @@ ``` |
@@ -426,6 +426,6 @@ import { directive, render } from '../lit-html/lit-html.js'; | ||
const useReducer = hook(class extends Hook { | ||
constructor(id, state, _, initialState) { | ||
constructor(id, state, _, initialState, init) { | ||
super(id, state); | ||
this.dispatch = this.dispatch.bind(this); | ||
this.currentState = initialState; | ||
this.currentState = init !== undefined ? init(initialState) : initialState; | ||
} | ||
@@ -432,0 +432,0 @@ update(reducer) { |
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
74591
558