当前位置: 首页>>代码示例>>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;未经允许,请勿转载。