1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-22 16:55:23 +01:00
deka-dom-el/src/helpers.js

17 lines
414 B
JavaScript
Raw Normal View History

2023-08-26 12:20:01 +02:00
export function typeOf(v){
const t= typeof v;
if(t!=="object") return t;
if(v===null) return "null";
return Object.prototype.toString.call(v);
}
export function onAbort(signal, listener){
if(!signal || !(signal instanceof AbortSignal))
return true;
if(signal.aborted)
return;
signal.addEventListener("abort", listener);
return function cleanUp(){
signal.removeEventListener("abort", listener);
};
}