@ljcl/storybook-addon-cssprops
Version:
Interact with css custom properties dynamically in the Storybook UI
11 lines (10 loc) • 406 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useWindowEvent = useWindowEvent;
var react_1 = require("react");
function useWindowEvent(type, listener, options) {
(0, react_1.useEffect)(function () {
window.addEventListener(type, listener, options);
return function () { return window.removeEventListener(type, listener, options); };
}, []);
}