Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / extensions / docs / templates / intros / dial.html
blob9d84882f83911337d7a18737af9e4c1f8968cb38
1 <p>The <code>chrome.dial</code> API is backed by a service that multicasts
2 discovery requests on the local network to discover DIAL-capable devices and
3 maintains a list of devices that have responded. Adding an onDeviceList
4 listener causes the service to periodically issue discovery requests to maintain
5 the device list. (No polling is done when there are no onDeviceList listeners.)
6 </p>
8 <p>The onDeviceList event is fired when discovery respnses are received and in
9 other circumstances; see the documentation for onDeviceList.</p>
11 <p>The client can request that network discovery can be done immediately by
12 invoking discoverNow() which is useful for presenting the user with an
13 updated list of devices.</p>
15 <p>On-demand use (updates when discoverNow() is called):
16 <pre>
17 chrome.dial.onDeviceList.addListener(function (list) { updateMenu(list); });
18 chrome.dial.discoverNow();
19 </pre>
20 (Remember to remove the listener when the menu closes.)</p>
22 <p>Background use (updates only when periodic polling happens):</p>
24 <pre>
25 var myList;
26 chrome.dial.onDeviceList.addListener(function (list) { myList = list; });
27 </pre>
29 <p>These can be combined to poll for devices to prime the device menu, then
30 refresh the menu when it is displayed.</p>