MCPcopy Create free account
hub / github.com/OpenWebCAD/node-occ / replaceObjectMethod

Method replaceObjectMethod

lib/fastbuilder.js:27–46  ·  view source on GitHub ↗
(obj, _methodName)

Source from the content-addressed store, hash-verified

25 }
26
27 replaceObjectMethod(obj, _methodName) {
28
29 const _originalMethod = obj[_methodName];
30 assert(isFunction(_originalMethod));
31 // create closure variable
32 const that = this;
33 const methodName = _methodName;
34 const originalMethod = _originalMethod;
35
36 function performOperation() {
37
38 return that.__performedCachedOperation(this, originalMethod, `${methodName}#${this.uuid}`, arguments);
39
40 }
41
42 Object.defineProperty(obj, methodName, {value: performOperation, enumerable: false});
43
44 // xx obj[methodName] = performOperation;=
45
46 }
47
48
49 installProxyMethods(obj) {

Callers 1

installProxyMethodsMethod · 0.80

Calls 1

isFunctionFunction · 0.85

Tested by

no test coverage detected