Share via


Device.onDeviceUpdated event

The onDeviceUpdated event occurs when the device has been updated, such as when a device property has been changed.

Syntax

Device.onDeviceUpdated()

Parameters

This event has no parameters.

Return value

This event does not return a value.

Examples

The following JScript example shows how to set and trigger an event handler for the onDeviceUpdated event.

// Event handler for onDeviceUpdated.
function HandleDeviceUpdated()
{
    Alert("onDeviceUpdated Event Handler: Device updated successfully.");
}

// Set the event handler.
try
{
    deviceObject.onDeviceUpdated = HandleDeviceUpdated;
}
catch(e)
{
    Alert("Device object does not support the onDeviceUpdated event.");
}

// Trigger the event handler by updating the DeviceFriendlyName
// property.
var oldName = deviceObject.DeviceFriendlyName; 
var newName = "DeviceUpdated-Event-Name";
deviceObject.DeviceFriendlyName = newName;

// Clear the event handler object and restore the DeviceFriendlyName.
deviceObject.onDeviceUpdated = null;
deviceObject.DeviceFriendlyName = oldName;

Requirements

Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
Windows Server 2008 R2 [desktop apps only]

See also

Device Object