summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/templates/intros/dial.html
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/docs/templates/intros/dial.html')
-rw-r--r--chrome/common/extensions/docs/templates/intros/dial.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/common/extensions/docs/templates/intros/dial.html b/chrome/common/extensions/docs/templates/intros/dial.html
new file mode 100644
index 0000000..9d84882
--- /dev/null
+++ b/chrome/common/extensions/docs/templates/intros/dial.html
@@ -0,0 +1,30 @@
+<p>The <code>chrome.dial</code> API is backed by a service that multicasts
+discovery requests on the local network to discover DIAL-capable devices and
+maintains a list of devices that have responded. Adding an onDeviceList
+listener causes the service to periodically issue discovery requests to maintain
+the device list. (No polling is done when there are no onDeviceList listeners.)
+</p>
+
+<p>The onDeviceList event is fired when discovery respnses are received and in
+other circumstances; see the documentation for onDeviceList.</p>
+
+<p>The client can request that network discovery can be done immediately by
+invoking discoverNow() which is useful for presenting the user with an
+updated list of devices.</p>
+
+<p>On-demand use (updates when discoverNow() is called):
+<pre>
+chrome.dial.onDeviceList.addListener(function (list) { updateMenu(list); });
+chrome.dial.discoverNow();
+</pre>
+(Remember to remove the listener when the menu closes.)</p>
+
+<p>Background use (updates only when periodic polling happens):</p>
+
+<pre>
+var myList;
+chrome.dial.onDeviceList.addListener(function (list) { myList = list; });
+</pre>
+
+<p>These can be combined to poll for devices to prime the device menu, then
+refresh the menu when it is displayed.</p>