本文整理汇总了TypeScript中electron.clipboard类的典型用法代码示例。如果您正苦于以下问题:TypeScript clipboard类的具体用法?TypeScript clipboard怎么用?TypeScript clipboard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了clipboard类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: showContextMenu
function showContextMenu(e) {
e.preventDefault();
const items: IContextMenuItem[] = [];
const pid = parseInt(e.currentTarget.id);
if (pid && typeof pid === 'number') {
items.push({
label: localize('killProcess', "Kill Process"),
click() {
process.kill(pid, 'SIGTERM');
}
});
items.push({
label: localize('forceKillProcess', "Force Kill Process"),
click() {
process.kill(pid, 'SIGKILL');
}
});
items.push({
type: 'separator'
});
items.push({
label: localize('copy', "Copy"),
click() {
const row = document.getElementById(pid.toString());
if (row) {
clipboard.writeText(row.innerText);
}
}
});
items.push({
label: localize('copyAll', "Copy All"),
click() {
const processList = document.getElementById('process-list');
if (processList) {
clipboard.writeText(processList.innerText);
}
}
});
} else {
items.push({
label: localize('copyAll', "Copy All"),
click() {
const processList = document.getElementById('process-list');
if (processList) {
clipboard.writeText(processList.innerText);
}
}
});
}
popup(items);
}
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:58,代码来源:processExplorerMain.ts
示例2: showContextMenu
function showContextMenu(e) {
e.preventDefault();
const menu = new remote.Menu();
const pid = parseInt(e.currentTarget.id);
if (pid && typeof pid === 'number') {
menu.append(new remote.MenuItem({
label: localize('killProcess', "Kill Process"),
click() {
process.kill(pid, 'SIGTERM');
}
}));
menu.append(new remote.MenuItem({
label: localize('forceKillProcess', "Force Kill Process"),
click() {
process.kill(pid, 'SIGKILL');
}
}));
menu.append(new remote.MenuItem({
type: 'separator'
}));
menu.append(new remote.MenuItem({
label: localize('copy', "Copy"),
click() {
const row = document.getElementById(pid.toString());
if (row) {
clipboard.writeText(row.innerText);
}
}
}));
menu.append(new remote.MenuItem({
label: localize('copyAll', "Copy All"),
click() {
const processList = document.getElementById('process-list');
if (processList) {
clipboard.writeText(processList.innerText);
}
}
}));
} else {
menu.append(new remote.MenuItem({
label: localize('copyAll', "Copy All"),
click() {
const processList = document.getElementById('process-list');
if (processList) {
clipboard.writeText(processList.innerText);
}
}
}));
}
menu.popup({ window: remote.getCurrentWindow() });
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:58,代码来源:processExplorerMain.ts
示例3: async
watcher.on(actions.copyToClipboard, async (store, action) => {
const text: string = action.payload.text;
clipboard.writeText(text);
store.dispatch(
actions.statusMessage({
message: ["status.copied_to_clipboard"],
})
);
});
开发者ID:HorrerGames,项目名称:itch,代码行数:9,代码来源:clipboard.ts
示例4: function
copyOutlineToClipboard: function() {
if (this.currentItems.length > 0) {
const headings: string[] = [];
for (const h of this.currentOutline) {
headings.push(`${' '.repeat(h.level)}- [${h.title}](#${h.hash})`);
}
clipboard.writeText(headings.join('\n'));
}
this.close();
},
开发者ID:WondermSwift,项目名称:Shiba,代码行数:10,代码来源:toc-dialog.ts
示例5:
socket.on('clipboard-writeBookmark', (title, url, type) => {
clipboard.writeBookmark(title, url, type);
});
开发者ID:E024,项目名称:Electron.NET,代码行数:3,代码来源:clipboard.ts
示例6:
$writeText(value: string): Promise<void> {
clipboard.writeText(value);
return undefined;
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:4,代码来源:mainThreadClipboard.ts
示例7: writeText
public writeText(text: string): void {
clipboard.writeText(text);
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:3,代码来源:clipboardService.ts
示例8:
supportFetchAPI: true,
});
webFrame.insertText('text');
webFrame.executeJavaScript('JSON.stringify({})', false, (result) => {
console.log(result);
}).then((result: string) => console.log('OK:' + result));
console.log(webFrame.getResourceUsage());
webFrame.clearCache();
// clipboard
// https://github.com/atom/electron/blob/master/docs/api/clipboard.md
clipboard.writeText('Example String');
clipboard.writeText('Example String', 'selection');
console.log(clipboard.readText('selection'));
console.log(clipboard.availableFormats());
clipboard.clear();
clipboard.write({
html: '<html></html>',
text: 'Hello World!',
image: clipboard.readImage()
});
// crash-reporter
// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md
crashReporter.start({
开发者ID:longlho,项目名称:DefinitelyTyped,代码行数:31,代码来源:github-electron-renderer-tests.ts
注:本文中的electron.clipboard类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论