diff --git a/docs/api/device_manager.md b/docs/api/device_manager.md index c1e283f86..4a6f6e914 100644 --- a/docs/api/device_manager.md +++ b/docs/api/device_manager.md @@ -19,12 +19,35 @@ const deviceManager = editor.Devices; ``` ## Available Events +* `device:add` New device added to the collection. The `Device` is passed as an argument. -* `device:add` - Added new device. The [Device] is passed as an argument to the callback -* `device:remove` - Device removed. The [Device] is passed as an argument to the callback -* `device:select` - New device selected. The newly selected [Device] and the previous one, are passed as arguments to the callback -* `device:update` - Device updated. The updated [Device] and the object containing changes are passed as arguments to the callback -* `device` - Catch-all event for all the events mentioned above. An object containing all the available data about the triggered event is passed as an argument to the callback +```javascript +editor.on('device:add', (device) => { ... }); +``` + +* `device:remove` Device removed from the collection. The `Device` is passed as an argument. + +```javascript +editor.on('device:remove', (device) => { ... }); +``` + +* `device:select` A new device is selected. The `Device` is passed as an argument. + +```javascript +editor.on('device:select', (device) => { ... }); +``` + +* `device:update` Device updated. The `Device` and the object containing changes are passed as arguments. + +```javascript +editor.on('device:update', (device) => { ... }); +``` + +* `device` Catch-all event for all the events mentioned above. + +```javascript +editor.on('device', ({ event, model, ... }) => { ... }); +``` ## Methods diff --git a/packages/core/src/device_manager/index.ts b/packages/core/src/device_manager/index.ts index f7b26772f..acc4a3edc 100644 --- a/packages/core/src/device_manager/index.ts +++ b/packages/core/src/device_manager/index.ts @@ -13,12 +13,7 @@ * ```js * const deviceManager = editor.Devices; * ``` - * ## Available Events - * * `device:add` - Added new device. The [Device] is passed as an argument to the callback - * * `device:remove` - Device removed. The [Device] is passed as an argument to the callback - * * `device:select` - New device selected. The newly selected [Device] and the previous one, are passed as arguments to the callback - * * `device:update` - Device updated. The updated [Device] and the object containing changes are passed as arguments to the callback - * * `device` - Catch-all event for all the events mentioned above. An object containing all the available data about the triggered event is passed as an argument to the callback + * {REPLACE_EVENTS} * * ## Methods * * [add](#add)