本文整理汇总了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()
}
}
示例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
}
示例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
},
示例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")
}
示例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
}
},
示例6: return
return (...args) => messageOwnTab("commandline_cmd", property as string, args)