<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 桌面通知 通知用戶發生了一些重要的事情。桌面通知會顯示在瀏覽器窗口之外。 下面的圖片是通知顯示時的效果,在不同的平臺下,通知的顯示效果會有些細微區別。 ![Notifications on Microsoft Windows](https://box.kancloud.cn/2015-12-28_5680aafbc1450.png) ![Notifications on Mac OS X](https://box.kancloud.cn/2015-12-28_5680aafbd259f.png) ![Notifications on Ubuntu Linux](https://box.kancloud.cn/2015-12-28_5680aafbe0f9f.png) 通常直接使用一小段 JavaScript 代碼創建通知,當然也可以通過擴展包內的一個單獨HTML頁面。 ## 聲明 可以在 [extension manifest](manifest.html) 中聲明使用通知權限,像這樣: ``` { "name": "My extension", ... **"permissions": [ "notifications" ]**, ... } ``` **注意:** 擴展聲明的 `notifications` 權限總是允許創建通知。 這樣申明之后就不再需要調用 `webkitNotifications.checkPermission()`。 ## 與擴展頁面交互 擴展可以使用 [getBackgroundPage()](extension.html#method-getBackgroundPage) 和 [getViews()](extension.html#method-getViews)在通知與擴展頁面中建立交互。 例如: ``` // 在通知中調用擴展頁面方法... chrome.extension.getBackgroundPage().doThing(); // 從擴展頁面調用通知的方法... chrome.extension.getViews({type:"notification"}).forEach(function(win) { win.doOtherThing(); }); ``` ## 例子 一個簡單的使用通知的例子,參見 [examples/api/notifications](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/notifications/) 目錄。 更多的例子,以及在查看代碼中遇到的一些問題,請參見 [代碼例子](samples.html)。 也可以參考 html5rocks.com 的 [通知指南](http://www.html5rocks.com/tutorials/notifications/quick/)。 如果你只是聲明 "通知" 的權限,可以忽略權限相關的代碼,它不是必要的。 ## API 擴展的桌面通知 API ,也可用于顯示一個網頁。 如以下代碼所示,首先創建一個簡單的文字通知或 HTML 通知,然后顯示通知。 ``` // 創建一個簡單的文字通知: var notification = webkitNotifications.createNotification( '48.png', // icon url - can be relative 'Hello!', // notification title 'Lorem ipsum...' // notification body text ); // 或者創建一個 HTML 通知: var notification = webkitNotifications.createHTMLNotification( 'notification.html' // html url - can be relative ); // 顯示通知 notification.show(); ``` 完整的 API 詳情,請參看 [Desktop notifications draft specification](http://dev.chromium.org/developers/design-documents/desktop-notifications/api-specification)。 ## API reference: chrome.apiname ### Properties <a></a> #### getLastError chrome.extensionlastError ### Methods <a></a> #### method name void chrome.module.methodName(, ``) Undocumented. A description from the json schema def of the function goes here. #### Parameters #### Returns #### Callback function The callback _parameter_ should specify a function that looks like this: If you specify the _callback_ parameter, it should specify a function that looks like this: ``` function(Type param1, Type param2) {...}; ``` This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. ### Events <a></a> #### event name chrome.bookmarksonEvent.addListener(function(Type param1, Type param2) {...}); Undocumented. A description from the json schema def of the event goes here. #### Parameters ### Types <a></a> #### type name
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看