本文整理汇总了TypeScript中remote.require函数的典型用法代码示例。如果您正苦于以下问题:TypeScript require函数的具体用法?TypeScript require怎么用?TypeScript require使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了require函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: buildMenu
function buildMenu(platform: string) {
var remote = require('remote');
var Menu = remote.require('menu');
var MenuItem = remote.require('menu-item');
var osModifier = modifier(platform);
var template = [
{
label: 'Electron',
submenu: [
{
label: 'About Electron',
selector: 'orderFrontStandardAboutPanel:'
},
{
type: 'separator'
},
{
label: 'Quit',
accelerator: osModifier('Q'),
selector: 'terminate:'
},
]
},
{
label: 'Edit',
submenu: [
{
label: 'Cut',
accelerator: osModifier('X'),
selector: 'cut:'
},
{
label: 'Copy',
accelerator: osModifier('C'),
selector: 'copy:'
},
{
label: 'Paste',
accelerator: osModifier('V'),
selector: 'paste:'
}
]
}
];
var menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}
开发者ID:schultyy,项目名称:jsterm,代码行数:50,代码来源:index.ts
示例2: require
(function () {
'use strict';
var remote = require('remote');
var Menu = remote.require('menu');
var MenuItem = remote.require('menu-item');
var cut = new MenuItem({
label: "Cut",
click: function () {
document.execCommand("cut");
}
});
var copy = new MenuItem({
label: "Copy",
click: function () {
document.execCommand("copy");
}
});
var paste = new MenuItem({
label: "Paste",
click: function () {
document.execCommand("paste");
}
});
var textMenu = new Menu();
textMenu.append(cut);
textMenu.append(copy);
textMenu.append(paste);
document.addEventListener('contextmenu', function(e:any) {
switch (e.target.nodeName) {
case 'TEXTAREA':
case 'INPUT':
e.preventDefault();
textMenu.popup(remote.getCurrentWindow());
break;
}
}, false);
}());
开发者ID:Dunkelheit777,项目名称:Vorlonjs,代码行数:45,代码来源:context_menu.ts
示例3: changeThema
export function changeThema(themaId: string) {
var cfg: config.Config = remote.getGlobal('cfg')
cfg.thema = themaId
remote.require('./services/config').writeConfig(remote.process.execPath, cfg)
switch(themaId) {
case 'thema-normal':
changeThemaMenu(themaId)
changeCssThemaFile('./css/thema-normal.css')
break
case 'thema-dark':
changeThemaMenu(themaId)
changeCssThemaFile('./css/thema-dark.css')
break
}
}
开发者ID:civic,项目名称:markcat,代码行数:16,代码来源:thema.ts
示例4: openFullscreened
export function openFullscreened(url) {
if (window['mbe_config'] && mbe_config.isElectron) {
url = new URL(url, location.href).toString();
var remote = require('remote');
var BrowserWindow = remote.require('browser-window');
var wind = new BrowserWindow({
// fullscreen: true, // 不是 HTML5 全屏,并没有什么用处
resizable: true,
width: screen.availWidth,
height: screen.availHeight,
'web-preferences': {
'plugins': true
}
});
wind.loadUrl(url);
// wind.openDevTools();
} else {
window.open(url);
}
}
开发者ID:huangxok,项目名称:mygiteditor,代码行数:20,代码来源:Window.ts
示例5: require
import Session from "../Session";
import PluginManager from "../PluginManager";
const remote = require("remote");
const app = remote.require("app");
PluginManager.registerEnvironmentObserver({
currentWorkingDirectoryWillChange: () => { /* do nothing */ },
currentWorkingDirectoryDidChange: (session: Session, directory: string) => {
app.addRecentDocument(directory);
remote.getCurrentWindow().setRepresentedFilename(directory);
},
});
开发者ID:Eugene-msc,项目名称:black-screen,代码行数:13,代码来源:PWDOperatingSystemIntegrator.ts
示例6: require
declare function require(name:string):any
declare var process:any;
var remote = require("remote");
var dialog = remote.require("dialog");
/**
* In example : { name: 'Images', extensions: ['jpg', 'png', 'gif'] }
*/
export interface ExtensionFilter {
name : string
extensions : string[]
}
interface FileDialogOptions {
title : string
properties : string[]
defaultPath? : string
filters? : ExtensionFilter[]
}
export function openFileDialogModal(title : string, defaultPath? : string, filters? : ExtensionFilter[]) : string {
var options = constructOptions(title, defaultPath, filters, ['openFile']);
return dialog.showOpenDialog(options);
}
export function openFileDialog(title : string, callBack : (path:string)=>void, defaultPath? : string,
filters? : ExtensionFilter[]) : void {
var options = constructOptions(title, defaultPath, filters, ['openFile']);
dialog.showOpenDialog(options, resultPath=> {
if(resultPath) callBack(resultPath[0])
}
开发者ID:naterkane,项目名称:atom-packages,代码行数:31,代码来源:fileDialogUtils.ts
注:本文中的remote.require函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论