當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript messaging.messageOwnTab函數代碼示例

本文整理匯總了TypeScript中@src/lib/messaging.messageOwnTab函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript messageOwnTab函數的具體用法?TypeScript messageOwnTab怎麽用?TypeScript messageOwnTab使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了messageOwnTab函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: resizeArea

/** @hidden **/
function resizeArea() {
    if (commandline_state.isVisible) {
        Messaging.messageOwnTab("commandline_content", "show")
        Messaging.messageOwnTab("commandline_content", "focus")
        focus()
    }
}
開發者ID:antonva,項目名稱:tridactyl,代碼行數:8,代碼來源:commandline_frame.ts

示例2: getClipboard

export async function getClipboard() {
    await Messaging.messageOwnTab("commandline_content", "focus")
    const result = applyWithTmpTextArea(scratchpad => {
        scratchpad.focus()
        document.execCommand("Paste")
        return scratchpad.textContent
    })
    // Return focus to the document
    await Messaging.messageOwnTab("commandline_content", "hide")
    await Messaging.messageOwnTab("commandline_content", "blur")
    return result
}
開發者ID:antonva,項目名稱:tridactyl,代碼行數:12,代碼來源:commandline_frame.ts

示例3: messageOwnTab

        "hide_and_clear": () => {
            cmdline_state.clear(true)
            cmdline_state.keyEvents = []

            // Try to make the close cmdline animation as smooth as possible.
            messageOwnTab("commandline_content", "hide")
            messageOwnTab("commandline_content", "blur")
            // Delete all completion sources - I don't think this is required, but this
            // way if there is a transient bug in completions it shouldn't persist.
            if (cmdline_state.activeCompletions)
                cmdline_state.activeCompletions.forEach(comp => cmdline_state.completionsDiv.removeChild(comp.node))
            cmdline_state.activeCompletions = undefined
            cmdline_state.isVisible = false
        },
開發者ID:antonva,項目名稱:tridactyl,代碼行數:14,代碼來源:commandline_cmds.ts

示例4: setClipboard

export async function setClipboard(content: string) {
    await Messaging.messageOwnTab("commandline_content", "focus")
    applyWithTmpTextArea(scratchpad => {
        scratchpad.value = content
        scratchpad.select()
        if (document.execCommand("Copy")) {
            // // todo: Maybe we can consider to using some logger and show it with status bar in the future
            logger.info("set clipboard:", scratchpad.value)
        } else throw "Failed to copy!"
    })
    // Return focus to the document
    await Messaging.messageOwnTab("commandline_content", "hide")
    return Messaging.messageOwnTab("commandline_content", "blur")
}
開發者ID:antonva,項目名稱:tridactyl,代碼行數:14,代碼來源:commandline_frame.ts

示例5: function

    function(keyevent: KeyboardEvent) {
        commandline_state.keyEvents.push(keyevent)
        const response = keyParser(commandline_state.keyEvents)
        if (response.isMatch) {
            keyevent.preventDefault()
            keyevent.stopImmediatePropagation()
        } else {
            // Ideally, all keys that aren't explicitly bound to an ex command
            // should be bound to a "self-insert" command that would input the
            // key itself. Because it's not possible to generate events as if
            // they originated from the user, we can't do this, but we still
            // need to simulate it, in order to have history() work.
            prev_cmd_called_history = false
        }
        if (response.exstr) {
            commandline_state.keyEvents = []
            history_called = false

            // Send excmds directly to our own tab, which fixes the
            // old bug where a command would be issued in one tab but
            // land in another because the active tab had
            // changed. Background-mode excmds will be received by the
            // own tab's content script and then bounced through a
            // shim to the background, but the latency increase should
            // be acceptable becuase the background-mode excmds tend
            // to be a touch less latency-sensitive.
            Messaging.messageOwnTab("controller_content", "acceptExCmd", [
                response.exstr,
            ]).then(_ => (prev_cmd_called_history = history_called))
        } else {
            commandline_state.keyEvents = response.keys
        }
    },
開發者ID:antonva,項目名稱:tridactyl,代碼行數:33,代碼來源:commandline_frame.ts

示例6: return

 return (...args) => messageOwnTab("commandline_cmd", property as string, args)
開發者ID:antonva,項目名稱:tridactyl,代碼行數:1,代碼來源:commandline_cmds.ts


注:本文中的@src/lib/messaging.messageOwnTab函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。