Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ObjectRegistry.prototype.register = function (obj) {
if (!this._objectType) {
this._objectType = obj.constructor;
}
if (!obj._____hash) {
obj._____hash = hashCounter;
hashCounter += 1;
this._cache[obj._____hash] = obj;
}
// istanbul ignore next
if (ObjectRegistry.doDebug) {
obj._____trace = trace_from_this_projet_only(new Error());
}
};
public register(obj: any): void {
if (!this._objectType) {
this._objectType = obj.constructor;
}
if (!obj._____hash) {
obj._____hash = hashCounter;
hashCounter += 1;
this._cache[obj._____hash] = obj;
}
// istanbul ignore next
if (ObjectRegistry.doDebug) {
obj._____trace = trace_from_this_projet_only();
}
}
exports.installResourceLeakDetector = function(isGlobal, func) {
const trace = trace_from_this_project_only();
if (isGlobal) {
before(function() {
const self = this;
resourceLeakDetector.ctx = self.test.ctx;
resourceLeakDetector.start();
// make sure we start with a garbage collected situation
if (global.gc) {
global.gc(true);
}
});
beforeEach(function() {
// make sure we start with a garbage collected situation
if (global.gc) {
global.gc(true);
}
ServerEngine.prototype.__internal_bindMethod = function (nodeId, func) {
const engine = this;
assert(_.isFunction(func));
assert(nodeId instanceof NodeId);
const methodNode = engine.addressSpace.findNode(nodeId);
if (!methodNode) {
return;
}
if (methodNode && methodNode.bindMethod) {
methodNode.bindMethod(func);
} else {
//xx console.log((new Error()).stack);
console.log("WARNING: cannot bind a method with id ".yellow + nodeId.toString().cyan + ". please check your nodeset.xml file or add this node programmatically".yellow);
console.log(require("node-opcua-debug").trace_from_this_projet_only(new Error()))
}
};
assert(_.isFunction(func));
assert(nodeId instanceof NodeId);
const methodNode = engine.addressSpace!.findNode(nodeId)! as UAMethod;
if (!methodNode) {
return;
}
if (methodNode && methodNode.bindMethod) {
methodNode.bindMethod(func);
} else {
console.log(
chalk.yellow("WARNING: cannot bind a method with id ") +
chalk.cyan(nodeId.toString()) +
chalk.yellow(". please check your nodeset.xml file or add this node programmatically"));
console.log(trace_from_this_projet_only());
}
}