diff --git a/.babelrc b/.babelrc
index 4146bb7..7a3ed4d 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,7 +1,10 @@
{
"presets": [
[
- "@babel/preset-env"
+ "@babel/preset-env",
+ {
+ "loose": true
+ }
]
]
}
\ No newline at end of file
diff --git a/src/core/HNode.ts b/src/core/HNode.ts
index b3f9085..35adc0f 100644
--- a/src/core/HNode.ts
+++ b/src/core/HNode.ts
@@ -32,19 +32,19 @@ export interface HDesc
= any, CH extends HandlerMap = any> {
- isHNode: true;
+ isHN: true;
type: unknown;
desc?: HDesc;
props: HProps
;
- store?: Store;
- context?: Store;
+ sto?: Store;
+ ctx?: Store;
owner?: HNode;
- ownerNode?: Node;
- output?: unknown[];
+ ownNode?: Node;
+ out?: unknown[];
nodes?: Node[];
active: boolean;
- events?: EventMap;
- error?: unknown;
+ evMap?: EventMap;
+ err?: unknown;
}
export const toNodeArr = function toNodes(
@@ -69,9 +69,9 @@ export const toNodeArr = function toNodes(
const { type, desc } = src;
- src.ownerNode = ownerNode;
+ src.ownNode = ownerNode;
src.owner = owner;
- src.context = context;
+ src.ctx = context;
if (desc) {
@@ -84,7 +84,7 @@ export const toNodeArr = function toNodes(
initComponent(src, store);
return src.nodes = toNodeArr(
- src.output = toArr(
+ src.out = toArr(
desc.render.call(src, src.props, store, context)
).flat(_Infinity),
context,
@@ -96,7 +96,7 @@ export const toNodeArr = function toNodes(
if (desc.catch) {
return src.nodes = toNodeArr(
- src.output = toArr(
+ src.out = toArr(
desc.catch.call(src, err, src.props, store, context)
).flat(_Infinity),
context,
@@ -115,7 +115,7 @@ export const toNodeArr = function toNodes(
const { props } = src;
- src.events = new _Map();
+ src.evMap = new _Map();
const element = props.xmlns ?
_document.createElementNS(props.xmlns, type as string) :
@@ -125,7 +125,7 @@ export const toNodeArr = function toNodes(
handleProp(element, src, pair[0], pair[1]);
});
- src.output = [];
+ src.out = [];
src.nodes = [element];
return [element];
diff --git a/src/core/HUI.ts b/src/core/HUI.ts
index 20c91a2..4af0b20 100644
--- a/src/core/HUI.ts
+++ b/src/core/HUI.ts
@@ -4,16 +4,16 @@ import { _assign, _Infinity, _requestAnimationFrame } from "../utils/refCache";
import { createStore } from "./Store";
import { renderToDOM } from "./render";
import { propHandlers, EleProps } from "./propHandlers";
-import { portalSymbol } from "../ext/Portal";
+import { Portal } from "../ext/Portal";
import { defer } from "../ticker/ticker";
-import { cmp } from "../utils/cmp";
-import { fragmentSymbol } from "../ext/Fragment";
+import { compare } from "../utils/cmp";
+import { Fragment } from "../ext/Fragment";
import { noCmpProps } from "../ticker/patch";
export const HUI = (
type: HType
| string, props?: P | null, ...children: unknown[]
): HNode
=> ({
- isHNode: true,
+ isHN: true,
type,
desc: registry.get(type),
props: _assign({ children: children.flat(_Infinity) }, props) as HProps
,
@@ -30,11 +30,11 @@ HUI.noCmpProps = noCmpProps;
HUI.render = renderToDOM;
-HUI.tick = function (callback: () => void) { _requestAnimationFrame(callback); };
+HUI.tick = function tick(callback: () => void) { _requestAnimationFrame(callback); };
HUI.frameLimit = 15;
HUI.defer = defer;
-HUI.Portal = portalSymbol;
-HUI.Fragment = fragmentSymbol;
+HUI.Portal = Portal;
+HUI.Fragment = Fragment;
-HUI.cmp = cmp;
+HUI.cmp = compare;
diff --git a/src/core/Store.ts b/src/core/Store.ts
index b6e0957..a1c8e15 100644
--- a/src/core/Store.ts
+++ b/src/core/Store.ts
@@ -48,7 +48,9 @@ export interface Store = any> {
}
-export const createStore = function = any>(): Store {
+export const createStore = function crtSto<
+ T extends object = any, H extends HandlerMap = any
+>(): Store {
const valueMap = new _Map(),
bindingMap = new _Map[]>(),
@@ -62,7 +64,7 @@ export const createStore = function {
if (bindingMap.has(key)) {
bindingMap.get(key)!.push(hNode);
@@ -73,11 +75,11 @@ export const createStore = function {
store.set(pair[0] as keyof T, pair[1], force);
});
return this;
},
- toggle: function store_toggle(key) {
+ toggle: function s_toggle(key) {
return store.set(key, !store.get(key) as any);
},
- inc: function store_inc(key, addition = 1) {
+ inc: function s_inc(key, addition = 1) {
return store.set(key, store.get(key) + addition);
},
- push: function store_push(key, ...items) {
+ push: function s_push(key, ...items) {
return store.set(key, (store.get(key) as unknown as any[]).concat(items) as any);
},
- unshift: function store_unshift(key, ...items) {
+ unshift: function s_unshift(key, ...items) {
return store.set(key, items.concat(store.get(key)) as any);
},
- slice: function store_slice(key, start, end) {
+ slice: function s_slice(key, start, end) {
return store.set(key, (store.get(key) as unknown as any[]).slice(start, end) as any);
},
- splice: function store_splice(key: keyof T, start: number, deleteCount: number, ...items: any[]) {
+ splice: function s_splice(key: keyof T, start: number, deleteCount: number, ...items: any[]) {
const arr = (store.get(key) as unknown as any[]).slice();
_splice.apply(arr, [start, deleteCount].concat(items) as SpliceArgs);
return store.set(key, arr as any);
},
- handle: function store_handle(name, handler) {
+ handle: function s_handle(name, handler) {
if (handler) {
handlerMap.set(name, handler.bind(store));
} else {
@@ -170,18 +172,18 @@ export const createStore = function {
store.handle(pair[0], pair[1]);
});
return this;
},
- getHandler: function store_getHandler(name) {
+ getHandler: function s_getHandler(name) {
return handlerMap.get(name) as any;
},
- trigger: function store_trigger(name, ...args) {
+ trigger: function s_trigger(name, ...args) {
const handler = handlerMap.get(name);
if (handler) {
return handler.apply(store, args);
diff --git a/src/core/events.ts b/src/core/events.ts
index 07ef347..3091704 100644
--- a/src/core/events.ts
+++ b/src/core/events.ts
@@ -1,12 +1,6 @@
export type EventRecord = [string, EventListener, boolean | AddEventListenerOptions];
export type EventMap = Map;
-export const LISTENER_PREFIX = 'on';
-
-const CAPTURE = 'Captrue',
- NONPASSIVE = 'Nonpassive',
- ONCE = 'Once';
-
export const listen = function (element: Element, event: string, listener: EventListener): EventRecord {
let capture = false,
@@ -14,13 +8,13 @@ export const listen = function (element: Element, event: string, listener: Event
once = false;
for (let i = 0; i < 3; i++) {
- if (event.endsWith(CAPTURE)) {
+ if (event.endsWith('Capture')) {
capture = true;
event = event.slice(0, -7);
- } else if (event.endsWith(NONPASSIVE)) {
+ } else if (event.endsWith('Nonpassive')) {
passive = false;
event = event.slice(0, -10);
- } else if (event.endsWith(ONCE)) {
+ } else if (event.endsWith('Once')) {
once = true;
event = event.slice(0, -4);
}
diff --git a/src/core/handleError.ts b/src/core/handleError.ts
index 70ccfa5..5d4f923 100644
--- a/src/core/handleError.ts
+++ b/src/core/handleError.ts
@@ -1,7 +1,7 @@
import { HNode } from "./HNode";
import { mark } from "../ticker/ticker";
-export const handleError = function (err: unknown, hNode: HNode) {
+export const handleError = function handleErr(err: unknown, hNode: HNode) {
let { owner } = hNode,
desc;
@@ -12,7 +12,7 @@ export const handleError = function (err: unknown, hNode: HNode) {
owner = owner.owner;
}
- owner.error = err;
+ owner.err = err;
mark(owner);
diff --git a/src/core/handleProp.ts b/src/core/handleProp.ts
index 114122b..e2286d1 100644
--- a/src/core/handleProp.ts
+++ b/src/core/handleProp.ts
@@ -1,5 +1,5 @@
import { propHandlers } from "./propHandlers";
-import { listen, LISTENER_PREFIX } from "./events";
+import { listen } from "./events";
import { HNode } from "./HNode";
export const handleProp = function (
@@ -14,16 +14,16 @@ export const handleProp = function (
} else {
- if (key.startsWith(LISTENER_PREFIX)) {
+ if (key.startsWith('on')) {
- const { events } = hNode,
- record = events!.get(key);
+ const { evMap } = hNode,
+ record = evMap!.get(key);
if (record) {
element.removeEventListener(record[0], record[1], record[2]);
}
- events!.set(key, listen(element, key.slice(2), newValue as EventListener));
+ evMap!.set(key, listen(element, key.slice(2), newValue as EventListener));
} else if (key in element) {
diff --git a/src/core/initComponent.ts b/src/core/initComponent.ts
index 3e0a61e..9aff5e9 100644
--- a/src/core/initComponent.ts
+++ b/src/core/initComponent.ts
@@ -2,9 +2,9 @@ import { HNode } from "./HNode";
import { Store } from "./Store";
import { supply } from "../utils/helpers";
-export const initComponent = function (hNode: HNode, store: Store) {
+export const initComponent = function initCom(hNode: HNode, store: Store) {
- const { props, context: ctxStore } = hNode,
+ const { props, ctx } = hNode,
desc = hNode.desc!,
{ defaultProps, defaultStore, storeHandlers, state, context, init } = desc;
@@ -12,23 +12,23 @@ export const initComponent = function (hNode: HNode, store: Store) {
supply(props, defaultProps);
}
- hNode.store = store;
+ hNode.sto = store;
if (defaultStore) {
store.setSome(defaultStore);
}
if (state) {
- hNode.store.bind(hNode, state);
+ hNode.sto.bind(hNode, state);
}
if (storeHandlers) {
store.handleSome(storeHandlers);
}
if (context) {
- ctxStore!.bind(hNode, context);
+ ctx!.bind(hNode, context);
}
if (init) {
- init.call(hNode, props, store, ctxStore!);
+ init.call(hNode, props, store, ctx!);
}
};
\ No newline at end of file
diff --git a/src/core/propHandlers.ts b/src/core/propHandlers.ts
index aaa4b80..3b50e12 100644
--- a/src/core/propHandlers.ts
+++ b/src/core/propHandlers.ts
@@ -24,11 +24,13 @@ export interface EleProps {
export const propHandlers = new _Map>([
- ['children', function (element, newChildren: unknown[], oldChildren: unknown[] | undefined, hNode) {
+ ['children', function chdHandler(
+ element, newChildren: unknown[], oldChildren: unknown[] | undefined, hNode
+ ) {
updateChildren(element, hNode, newChildren, oldChildren || []);
}],
- ['style', function (element, style) {
+ ['style', function styHandler(element, style) {
type HTMLElementOrSVG = HTMLElement | SVGSVGElement;
if (style && isObject(style)) {
_assign((element as HTMLElementOrSVG).style, style);
@@ -41,7 +43,7 @@ export const propHandlers = new _Map>([
}
}],
- ['class', function (element, classes) {
+ ['class', function clsHandler(element, classes) {
element.setAttribute(
'class',
_isArray(classes) ?
@@ -50,17 +52,17 @@ export const propHandlers = new _Map>([
);
}],
- ['ref', function (element, callback: RefCallback) {
+ ['ref', function refHandler(element, callback: RefCallback) {
callback(element);
}],
- ['attr', function (element, attributes: AttributeMap) {
+ ['attr', function attrHandler(element, attributes: AttributeMap) {
_entries(attributes).forEach(pair => {
element.setAttribute(pair[0], pair[1]);
});
}],
- ['prop', function (element, properties: Partial) {
+ ['prop', function propHandler(element, properties: Partial) {
_assign(element, properties);
}]
diff --git a/src/core/render.ts b/src/core/render.ts
index 9aff75b..ec750f6 100644
--- a/src/core/render.ts
+++ b/src/core/render.ts
@@ -2,7 +2,7 @@ import { toNodeArr, HNode } from "./HNode";
import { _document, _assign, _from } from "../utils/refCache";
import { createStore, Store, HandlerMap, PartialHandlers } from "./Store";
import { toFrag } from "../utils/helpers";
-import { DeferCallback, reqTick } from "../ticker/ticker";
+import { DeferCallback, reqTick, willTick } from "../ticker/ticker";
export const renderCallbacks = new Array>();
@@ -47,7 +47,9 @@ export const renderToDOM = function render('HUI.Fragment', {
- render: function fragment_render(props) {
+export const Fragment = define('HUI.Fragment', {
+ render: function frag_render(props) {
return props.children;
}
});
diff --git a/src/ext/Portal.ts b/src/ext/Portal.ts
index 19d24b5..eef8be6 100644
--- a/src/ext/Portal.ts
+++ b/src/ext/Portal.ts
@@ -3,7 +3,7 @@ import { define } from "../core/registry";
import { _document, _null } from "../utils/refCache";
import { clear } from "../utils/clear";
import { HNode } from "../core/HNode";
-import { FragmentProps } from "./Fragment";
+import { FragmentProps, Fragment } from "./Fragment";
import { HUI } from "../core/HUI";
export interface PortalProps {
@@ -12,34 +12,34 @@ export interface PortalProps {
}
export interface PortalStore {
- parent: Node;
- fragment: HNode;
+ p: Node;
+ f: HNode;
}
-export const portalSymbol = define('HUI.Portal', {
+export const Portal = define('HUI.Portal', {
- init: function portal_init(props, store) {
- store.set('parent', props.parent || _document.body);
- store.set('fragment', HUI(HUI.Fragment, _null, props.children));
+ init: function port_init(props, store) {
+ store.set('p', props.parent || _document.body);
+ store.set('f', HUI(Fragment, _null, props.children));
},
- render: function portal_render(props, store, context) {
- renderToDOM(store.get('fragment'), {
- parent: store.get('parent'),
+ render: function port_render(props, store, context) {
+ renderToDOM(store.get('f'), {
+ parent: store.get('p'),
owner: this,
context
});
},
- clear: function portal_clear(props, store) {
+ clear: function port_clear(props, store) {
- const fragment = store.get('fragment')!,
- { ownerNode, nodes } = fragment;
+ const fragment = store.get('f')!,
+ { ownNode, nodes } = fragment;
clear(fragment);
nodes!.forEach(node => {
- ownerNode!.removeChild(node);
+ ownNode!.removeChild(node);
});
nodes!.length = 0;
diff --git a/src/ticker/patch.ts b/src/ticker/patch.ts
index 6d90afc..018dbb8 100644
--- a/src/ticker/patch.ts
+++ b/src/ticker/patch.ts
@@ -4,7 +4,7 @@ import { handleProp } from "../core/handleProp";
export const noCmpProps = ['children'];
-export const patch = function patchElement(
+export const patch = function patchEle(
element: Element, hNode: HNode, curProps: any, oldProps: any, curPropKeys: string[]
) {
diff --git a/src/ticker/ticker.ts b/src/ticker/ticker.ts
index ccd5eae..ec6286b 100644
--- a/src/ticker/ticker.ts
+++ b/src/ticker/ticker.ts
@@ -4,16 +4,15 @@ import { HUI } from "../core/HUI";
import { updateComponent } from "./updateComponent";
import { renderCallbacks } from "../core/render";
-export type DeferCallback = (...args: A) => void;
+export type DeferCallback = (this: void, ...args: A) => void;
export const expired = new Array | undefined>();
-const deferCallbacks = new Array(),
- preDeferCallbacks = new Array>();
+const deferCallbacks = new Array();
-let willTick = false;
+export let willTick = false;
-const ticker = function () {
+const ticker = function frame() {
willTick = false;
@@ -41,33 +40,20 @@ const ticker = function () {
if (_now() >= deadline) {
expired.splice(0, i + 1);
- return tick();
+ return reqTick();
}
}
expired.length = 0;
- for (i = 0; i < preDeferCallbacks.length; i++) {
-
- preDeferCallbacks[i]();
-
- if (_now() >= deadline) {
- preDeferCallbacks.splice(0, i + 1);
- return tick();
- }
-
- }
-
- preDeferCallbacks.length = 0;
-
for (i = 0; i < renderCallbacks.length; i++) {
renderCallbacks[i]();
if (_now() >= deadline) {
renderCallbacks.splice(0, i + 1);
- return tick();
+ return reqTick();
}
}
@@ -80,7 +66,7 @@ const ticker = function () {
if (_now() >= deadline) {
deferCallbacks.splice(0, i + 1);
- return tick();
+ return reqTick();
}
}
@@ -89,30 +75,28 @@ const ticker = function () {
};
-const tick = function () {
+export const reqTick = function () {
HUI.tick(ticker);
willTick = true;
};
-export const reqTick = function () {
- if (!willTick) {
- tick();
- }
-};
-
export const mark = function (hNode: HNode) {
if (!expired.includes(hNode)) {
- reqTick();
expired.push(hNode);
+ if (!willTick) {
+ reqTick();
+ }
}
};
export const defer = function (callback: DeferCallback, ...args: A) {
deferCallbacks.push(function () {
- callback(...args);
+ callback.apply(_undefined, args);
});
- reqTick();
+ if (!willTick) {
+ reqTick();
+ }
};
diff --git a/src/ticker/updateChildren.ts b/src/ticker/updateChildren.ts
index f81f05a..012b9a8 100644
--- a/src/ticker/updateChildren.ts
+++ b/src/ticker/updateChildren.ts
@@ -8,7 +8,7 @@ import { HUI } from "../core/HUI";
import { mark } from "./ticker";
import { EleProps } from "../core/propHandlers";
-export const updateChildren = function (
+export const updateChildren = function updChd(
element: Element, hNode: HNode, newChildren: unknown[], oldChildren: unknown[]
) {
@@ -77,7 +77,7 @@ export const updateChildren = function (
oldNodes = childNodes.length ? [childNodes[nodeOffset]] : [];
}
- nodeOffset += (newNodes = toNodeArr(newChild, hNode.context!, element, hNode)).length;
+ nodeOffset += (newNodes = toNodeArr(newChild, hNode.ctx!, element, hNode)).length;
if (oldNodes.length) {
replaceNodes(element, oldNodes, newNodes);
@@ -104,7 +104,7 @@ export const updateChildren = function (
renderToDOM(newChildren.slice(oldChildrenCount), {
parent: element,
owner: hNode,
- context: hNode.context
+ context: hNode.ctx
});
}
diff --git a/src/ticker/updateComponent.ts b/src/ticker/updateComponent.ts
index 6fc242c..b9c4110 100644
--- a/src/ticker/updateComponent.ts
+++ b/src/ticker/updateComponent.ts
@@ -7,9 +7,9 @@ import { handleError } from "../core/handleError";
import { clear } from "../utils/clear";
import { mark } from "./ticker";
-export const updateComponent = function (hNode: HNode) {
+export const updateComponent = function updCom(hNode: HNode) {
- const { desc, output, nodes, owner, ownerNode, context, props, store, error } = hNode,
+ const { desc, out: output, nodes, owner, ownNode: ownerNode, ctx: context, props, sto: store, err: error } = hNode,
outputLength = output!.length,
ownerNodes = owner && owner.nodes!;
@@ -20,7 +20,7 @@ export const updateComponent = function (hNode: HNode) {
hNode.active = false;
if (error) {
- hNode.error = _undefined;
+ hNode.err = _undefined;
throw error;
}
@@ -29,7 +29,7 @@ export const updateComponent = function (hNode: HNode) {
curNodes: Node[], curProps: any, curPropKeys: string[],
nodeOffset = 0, nextNode: Node | null;
- (hNode.output = toArr(
+ (hNode.out = toArr(
desc!.render.call(hNode, props, store!, context!)
).flat(_Infinity)).forEach((cur: unknown, i) => {
@@ -117,7 +117,7 @@ export const updateComponent = function (hNode: HNode) {
if (desc!.catch) {
newNodes = toNodeArr(
- hNode.output = toArr(desc!.catch!.call(hNode, err, props, store!, context!)),
+ hNode.out = toArr(desc!.catch!.call(hNode, err, props, store!, context!)),
context!,
ownerNode!,
hNode
diff --git a/src/utils/clear.ts b/src/utils/clear.ts
index 53bc9a5..9812469 100644
--- a/src/utils/clear.ts
+++ b/src/utils/clear.ts
@@ -2,11 +2,10 @@ import { expired } from "../ticker/ticker";
import { HNode } from "../core/HNode";
import { _console } from "./refCache";
import { isHNode } from "./helpers";
-import { EleProps } from "../core/propHandlers";
-export const clear = function (hNode: HNode) {
+export const clear = function clr(hNode: HNode) {
- const { desc, output } = hNode;
+ const { desc, out: output, props } = hNode;
hNode.active = false;
@@ -14,7 +13,7 @@ export const clear = function (hNode: HNode) {
if (desc.clear) {
try {
- desc.clear.call(hNode, hNode.props, hNode.store!, hNode.context!);
+ desc.clear.call(hNode, props, hNode.sto!, hNode.ctx!);
} catch (err) {
_console.error(err);
}
@@ -22,9 +21,8 @@ export const clear = function (hNode: HNode) {
} else {
- const { ref } = hNode.props as EleProps;
- if (ref) {
- ref();
+ if (props.ref) {
+ props.ref();
}
}
diff --git a/src/utils/cmp.ts b/src/utils/cmp.ts
index 963c5e2..3950984 100644
--- a/src/utils/cmp.ts
+++ b/src/utils/cmp.ts
@@ -2,7 +2,7 @@ import { _is, _isArray, _Node, _keys, SYMBOL_ITERATOR, _from, _toString } from "
import { HNode } from "../core/HNode";
import { isObject } from "./helpers";
-export const cmp = function compare(a: unknown, b: unknown): boolean {
+export const compare = function cmp(a: unknown, b: unknown): boolean {
if (_is(a, b)) {
return true;
@@ -11,7 +11,7 @@ export const cmp = function compare(a: unknown, b: unknown): boolean {
if (_isArray(a)) {
return _isArray(b) &&
a.length === b.length &&
- a.every((v, i) => cmp(b[i], v));
+ a.every((v, i) => compare(b[i], v));
}
if (
@@ -23,13 +23,13 @@ export const cmp = function compare(a: unknown, b: unknown): boolean {
if ((a as any)[SYMBOL_ITERATOR]) {
return (b as any)[SYMBOL_ITERATOR] &&
- cmp(_from(a as Iterable), _from(b as Iterable));
+ compare(_from(a as Iterable), _from(b as Iterable));
- } else if ((a as HNode).isHNode) {
+ } else if ((a as HNode).isHN) {
- return (b as HNode).isHNode &&
+ return (b as HNode).isHN &&
(a as HNode).type === (b as HNode).type &&
- cmp((a as HNode).props, (b as HNode).props);
+ compare((a as HNode).props, (b as HNode).props);
} else if (!(a instanceof _Node || b instanceof _Node)) {
@@ -37,7 +37,7 @@ export const cmp = function compare(a: unknown, b: unknown): boolean {
keysB = _keys(b!);
return keysA.length === keysB.length &&
- keysA.every(k => keysB.includes(k) && cmp((a as any)[k], (b as any)[k]));
+ keysA.every(k => keysB.includes(k) && compare((a as any)[k], (b as any)[k]));
}
diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts
index 8f35d1b..60496c4 100644
--- a/src/utils/helpers.ts
+++ b/src/utils/helpers.ts
@@ -9,10 +9,11 @@ export const toFrag = (nodes: Node[]) => nodes.reduce(
_document.createDocumentFragment()
);
-export const isHNode = (value: unknown): value is HNode =>
- value && isObject(value) && (value as HNode).isHNode;
+export const isHNode = function isHN(value: unknown): value is HNode {
+ return value && isObject(value) && (value as HNode).isHN;
+}
-export const replaceNodes = function (ownerNode: Node, oldNodes: Node[], newNodes: Node[]) {
+export const replaceNodes = function replNodes(ownerNode: Node, oldNodes: Node[], newNodes: Node[]) {
oldNodes.forEach((oldNode, i) => {
if (i) {
ownerNode.removeChild(oldNode);
@@ -26,14 +27,14 @@ export const inherit = function (target: HNode, source: HNode) {
target.nodes = source.nodes;
target.owner = source.owner;
- target.ownerNode = source.ownerNode;
- target.context = source.context;
- target.store = source.store;
+ target.ownNode = source.ownNode;
+ target.ctx = source.ctx;
+ target.sto = source.sto;
if (source.desc) {
- target.output = source.output;
+ target.out = source.out;
} else {
- target.events = source.events;
+ target.evMap = source.evMap;
}
};
@@ -48,4 +49,6 @@ export const supply = function (target: T, defaults: T)
});
};
-export const isObject = (value: unknown): value is object => typeof value === 'object';
+export const isObject = function isObj(value: unknown): value is object {
+ return typeof value === 'object';
+};