-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBindingTestLibrary.js
More file actions
34 lines (27 loc) · 1.74 KB
/
Copy pathBindingTestLibrary.js
File metadata and controls
34 lines (27 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function (global) {
const bindingTestLibrary = {
};
class TestClass {
randomValue;
constructor() {
this.randomValue = Math.random();
}
}
bindingTestLibrary.isPlainObjectPassed = (obj) => { return obj?.isTestClass === true || false };
const testObjectReferenceReviverInstance = new TestClass();
bindingTestLibrary.getTestObjectReviverInstanceFromFunction = () => testObjectReferenceReviverInstance;
bindingTestLibrary.testObjectReviverInstanceFromProperty = testObjectReferenceReviverInstance;
bindingTestLibrary.isObjectReferenceRevived = (instance) => instance === testObjectReferenceReviverInstance;
bindingTestLibrary.isNestedObjectReferenceRevived = (nestedObject) => nestedObject.instance === testObjectReferenceReviverInstance;
bindingTestLibrary.isDelegateReferenceRevived = (delegateReference) => typeof(delegateReference) === "function";
bindingTestLibrary.isNestedDelegateReferenceRevived = (nestedObject) => typeof(nestedObject.delegate) === "function";
bindingTestLibrary.areDelegateReferencesEqual = (delegateReference1, delegateReference2) => delegateReference1 === delegateReference2;
bindingTestLibrary.testInvokeDelegate = (delegateReference, ...args) => delegateReference(...args);
bindingTestLibrary.testInvokeDelegateAsync = async (delegateReference, ...args) => delegateReference(...args);
function functionDelegate() { return true; }
bindingTestLibrary.getFunctionDelegate = () => functionDelegate;
bindingTestLibrary.getNestedActionDelegate = () => { return { action: functionDelegate }; };
function mirrorFunctionDelegate(val) { return val; }
bindingTestLibrary.getMirrorFunctionDelegate = () => mirrorFunctionDelegate;
global.BindingTestLibrary = bindingTestLibrary;
})(globalThis);