Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The onObjectAdded event occurs after an object has been added to this Storage object.
Syntax
Storage.onObjectAdded(
wpdObject
)
Parameters
-
wpdObject
-
The WPDObject that was added.
Return value
This event does not return a value.
Examples
The following code shows the handler-function syntax for the onObjectAdded event.
function HandlerFunction(wpdObject)
{
// Code to handle a newly added object.
}
// Set the event handler.
Storage.onObjectAdded = HandlerFunction;
Note
We recommended that you clear the event handler of a Storage object variable by setting it to null, before reusing that variable to represent a new object. This will keep an event handler object from persisting as a property of the old Storage object.
The following example demonstrates this with the Storage object variable "currentStorage". The variable is used to represent one Storage object, and a handler-function is set for that object. The handler-function is then cleared before currentStorage is used to represent a new Storage object.
// Set this variable to represent a Storage object.
currentStorage = deviceObject.Storages[0];
// Set the event handler for the Storage object.
currentStorage.onObjectAdded = HandlerFunction;
// Do something with the storage object.
...
// Clear the event handler when done with the storage object.
currentStorage.onObjectAdded = null;
// Set the variable to represent a new Storage object.
currentStorage = deviceObject.Storages[1];
Requirements
| Minimum supported client |
Windows 7 [desktop apps only] |
| Minimum supported server |
Windows Server 2008 R2 [desktop apps only] |