@faceless-ui/jumplist
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -14,2 +14,3 @@ export declare type JumplistNode = { | ||
activeJumplistIndex?: number; | ||
clearJumplist: () => void; | ||
} |
@@ -72,2 +72,7 @@ "use strict"; | ||
}, []); | ||
var clearJumplist = (0, react_1.useCallback)(function () { | ||
dispatchNodes({ | ||
type: 'clear' | ||
}); | ||
}, []); | ||
(0, react_1.useEffect)(function () { | ||
@@ -84,3 +89,4 @@ if (nodesFromProps) { | ||
setJumplist: setJumplist, | ||
activeJumplistIndex: activeJumplistIndex | ||
activeJumplistIndex: activeJumplistIndex, | ||
clearJumplist: clearJumplist | ||
}; | ||
@@ -87,0 +93,0 @@ return (react_1.default.createElement(JumplistContext_1.JumplistContext.Provider, { value: context }, (children && (typeof children === 'function' ? children(__assign({}, context)) : children)))); |
import { JumplistNode, JumplistNodes } from "../JumplistContext/types"; | ||
export declare const jumplistReducer: (state: JumplistNodes, action: { | ||
type: 'sync' | 'remove' | 'reset'; | ||
payload: Partial<JumplistNode>; | ||
type: 'sync' | 'remove' | 'reset' | 'clear'; | ||
payload?: Partial<JumplistNode>; | ||
}) => JumplistNodes; |
@@ -25,4 +25,8 @@ "use strict"; | ||
var jumplistReducer = function (state, action) { | ||
var newState = __spreadArray([], state, true); | ||
var newState = __spreadArray([], state || [], true); | ||
switch (action.type) { | ||
case 'clear': { | ||
newState = []; | ||
break; | ||
} | ||
case 'reset': { | ||
@@ -29,0 +33,0 @@ newState = action.payload; // TODO: type this better |
{ | ||
"name": "@faceless-ui/jumplist", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
752906
1223