@garage-panda/use-await-dom-render
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,0 +0,0 @@ declare type DomObserverCallback = (...args: any[]) => void; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,1 +0,1 @@ | ||
export * from "./useAwaitDomRender"; | ||
export { default as useAwaitDomRender, StartWaitFunc, UseAwaitDomRenderResult } from "./useAwaitDomRender"; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./useAwaitDomRender"), exports); | ||
exports.useAwaitDomRender = void 0; | ||
var useAwaitDomRender_1 = require("./useAwaitDomRender"); | ||
Object.defineProperty(exports, "useAwaitDomRender", { enumerable: true, get: function () { return __importDefault(useAwaitDomRender_1).default; } }); |
@@ -1,2 +0,5 @@ | ||
declare const _default: (waitTimeMs?: number) => any[]; | ||
import DomObserver from "./DomObserver"; | ||
export declare type StartWaitFunc = (targetNode: Node) => void; | ||
export declare type UseAwaitDomRenderResult = [DomObserver, StartWaitFunc]; | ||
declare const _default: (waitTimeMs?: number) => UseAwaitDomRenderResult; | ||
export default _default; |
@@ -14,6 +14,8 @@ "use strict"; | ||
}, []); | ||
var observer = react_1.default.useMemo(function () { return new DomObserver_1.default(function () { | ||
receiveDomUpdate(); | ||
observer.call('dom-update'); | ||
}); }, [receiveDomUpdate]); | ||
var observer = react_1.default.useMemo(function () { | ||
return new DomObserver_1.default(function () { | ||
receiveDomUpdate(); | ||
observer.call("dom-update"); | ||
}); | ||
}, [receiveDomUpdate]); | ||
react_1.default.useEffect(function () { | ||
@@ -23,3 +25,3 @@ if (updatesCount === 0) | ||
var timeout = setTimeout(function () { | ||
observer.call('load'); | ||
observer.call("load"); | ||
observer.disconnect(); | ||
@@ -30,13 +32,9 @@ }, waitTimeMs); | ||
}; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [updatesCount]); | ||
var startWait = react_1.default.useCallback(function (targetNode) { | ||
setUpdatesCount(0); | ||
observer.call('start'); | ||
observer.call("start"); | ||
observer.startDomWait(targetNode); | ||
}, [observer]); | ||
return [ | ||
observer, | ||
startWait, | ||
]; | ||
return [observer, startWait]; | ||
}); |
{ | ||
"name": "@garage-panda/use-await-dom-render", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "React hook that is used to await all DOM elements inside a node to be rendered", | ||
@@ -22,3 +22,6 @@ "main": "lib/index.js", | ||
"await", | ||
"render" | ||
"render", | ||
"component", | ||
"onload", | ||
"domready" | ||
], | ||
@@ -25,0 +28,0 @@ "author": "Garage Panda", |
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
6919
120