diff --git a/dom/interfaces/push/moz.build b/dom/interfaces/push/moz.build new file mode 100644 index 000000000000..087c553ef51d --- /dev/null +++ b/dom/interfaces/push/moz.build @@ -0,0 +1,9 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +MODULE = 'dom' +XPIDL_MODULE = 'dom_push' +XPIDL_SOURCES += ['nsIDOMPushManager.idl'] +XPIDL_FLAGS += ['-I$(topsrcdir)/dom/interfaces/base'] diff --git a/dom/interfaces/push/nsIDOMPushManager.idl b/dom/interfaces/push/nsIDOMPushManager.idl new file mode 100644 index 000000000000..12a853267cf8 --- /dev/null +++ b/dom/interfaces/push/nsIDOMPushManager.idl @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" +interface nsIDOMDOMRequest; + +/** + * Client API for SimplePush. + * + * The SimplePush API allows web applications to use push notifications and be + * woken up when something of interest has changed. This frees web applications + * from implementing polling, giving better responsiveness and conserving the + * device's battery life. + */ +[scriptable,uuid(c7ad4f42-faae-4e8b-9879-780a72349945)] +interface nsIDOMPushManager : nsISupports +{ + /** + * Register for a new push endpoint. + * + * On success, the DOMRequest's result field will be a string URL. This URL + * is the endpoint that can be contacted to wake up the application. + */ + nsIDOMDOMRequest register(); + + /** + * Unregister a push endpoint. + * + * On success, the DOMRequest's result field will be the endpoint that was + * passed in. + * + * Stops watching for changes to this URL. + */ + nsIDOMDOMRequest unregister(in ACString endpoint); + + /** + * Get a list of active registrations for this web app. + * + * On success, the DOMRequest's result field is an array of endpoints. + * For example: + * ["https://example.com/notify/1", "https://example.com/notify/2"] + */ + nsIDOMDOMRequest registrations(); +};