API Device Manager

Artur Arseniev edited this page Aug 8, 2016 · 1 revision

DeviceManager

Before using methods you should get first the module from the editor instance, in this way:

var deviceManager = editor.DeviceManager;

Parameters

  • config Object Configurations
    • config.devices Array.<Object>= Default devices (optional, default [])

Examples

...
deviceManager: {
   devices: [
     {name: 'Desktop', width: ''}
     {name: 'Tablet', width: '991px'}
   ],
}
...

add

Add new device to the collection. URLs are supposed to be unique

Parameters

Examples

deviceManager.add('Tablet', '900px');

Returns Device Added device

get

Return device by name

Parameters

  • name string Name of the device

Examples

var device = deviceManager.get('Tablet');
console.log(JSON.stringify(device));
// {name: 'Tablet', width: '900px'}

getAll

Return all devices

Examples

var devices = deviceManager.getAll();
console.log(JSON.stringify(devices));
// [{name: 'Desktop', width: ''}, ...]

Returns Collection