What is the proper procedure for removing a device? I want to eliminate any memory leaks that results from a removed device.
I create the device using
Code: Select all
var newVirtualDevice = new VirtualDevice(virtualDevice.id, virtualDevice.type);
Code: Select all
zwayBinding = zway.bind(function (type, nodeId, instanceId, commandClassId) {
if (type === ZWAY_DEVICE_CHANGE_TYPES["DeviceAdded"]) {
console.log("Device Added " + nodeId);
}
else if (type === ZWAY_DEVICE_CHANGE_TYPES["DeviceRemoved"]) {
console.log("Device Removed " + nodeId);
}
}, ZWAY_DEVICE_CHANGE_TYPES["DeviceAdded"] | ZWAY_DEVICE_CHANGE_TYPES["DeviceRemoved"]);
Code: Select all
newVirtualDevice.unbindDataPoints(); //this routine unbinds all datapoint bindings
newVirtualDevice = null;