當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript remote.require函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。