• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript remote.require函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript modal-widgets.modalWidgets.naked类代码示例发布时间:2022-05-25
下一篇:
TypeScript remarkable.render函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap