<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                app提供方法js如何調用: ``` /** * 檢查ios是否提供handName方法 | 并執行 * @param handName string 調用的方法名稱 * @param message string 發送的內容 * 目前了解到的ios不提供return,如需獲取app返回信息需提供給app一個回調函數 * 還有另一種方式 window.prompt('getToken', '') 需app提供這種調用方式 */ function HandIos(handName: string, message?: string) { if (windows.webkit && windows.webkit.messageHandlers !== undefined && windows.webkit.messageHandlers[handName] !== undefined) { if (message === undefined) { windows.webkit.messageHandlers[handName].postMessage(''); } else { windows.webkit.messageHandlers[handName].postMessage(message); } } } /** * 檢查Android是否提供handName方法 | 并執行 * @param handName string 調用的方法名稱 * @param message string 發送的內容 * @return any */ function HandAndroid(handName: string, message?: string): any { if (windows.android !== undefined && windows.android[handName] !== undefined) { if (message === undefined) { return windows.android[handName](); } else { return windows.android[handName](message); } } return false; } ``` # ### 上面說到ios沒有return處理方式 ``` let token: string = ''; export async function setToken(): Promise<void> { if (Ios && token === '') { setTimeout(() => { (window as any).setToken = (msg: string) => { // js 給app提供setToken 方法回調 token = msg; } // 執行app 提供的 HandIos('getToken') 方法 }, 10) await sleep(500); // 延遲執行 } } ``` await sleep(500); // 延遲執行 [查看](http://www.hmoore.net/book/yejunhong/webapp/preview/js-%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95.md) # ### js提供方式給app使用 ``` window.setToken = (msg: string) => { // js 給app提供setToken 方法回調 console.log(msg); } window.testString= (msg: string) => { // js 給app提供setToken 方法回調 console.log(msg); } ```
                  <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>

                              哎呀哎呀视频在线观看