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

TypeScript electron.remote类代码示例

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

本文整理汇总了TypeScript中electron.remote的典型用法代码示例。如果您正苦于以下问题:TypeScript remote类的具体用法?TypeScript remote怎么用?TypeScript remote使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了remote类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getGlobal

export function getGlobal(attributeName: string, defaultValue?: any): any {
    if (global[attributeName]) {
        return global[attributeName];
    } else if (Electron.remote && Electron.remote.getGlobal(attributeName)) {
        return Electron.remote.getGlobal(attributeName)
    } else {
        return defaultValue;
    }
}
开发者ID:kpreeti096,项目名称:BotFramework-Emulator,代码行数:9,代码来源:globals.ts


示例2: function

 document.addEventListener('contextmenu', function (e :any) {
     switch (e.target.nodeName) {
         case 'TEXTAREA':
         case 'INPUT':
             e.preventDefault();
             textEditingMenu.popup(remote.getCurrentWindow());
             break;
         default:
             if (isAnyTextSelected()) {
                 e.preventDefault();
                 normalMenu.popup(remote.getCurrentWindow());
             }
     }
 }, false);
开发者ID:frieck,项目名称:WiN,代码行数:14,代码来源:context_menu.ts


示例3: _setup

function _setup() {
	const electron = require('electron');
	const win = electron.remote.getCurrentWindow();

	function getButtonAndBindClick(btn: string, fn: EventListener) {
		const elem = document.getElementById(`btn-${btn}`);
		elem.addEventListener('click', fn);
		return elem;
	}

	const btnMinimize = getButtonAndBindClick('minimize', () => win.minimize());
	const btnMaximize = getButtonAndBindClick('maximize', () => win.maximize());
	const btnRestore  = getButtonAndBindClick('restore' , () => win.restore());
	const btnClose    = getButtonAndBindClick('close'   , () => win.close());

	function updateButtons() {
		const isMax = win.isMaximized();
		btnMaximize.hidden = isMax;
		btnRestore.hidden = !isMax;
	}

	win.on('unmaximize', updateButtons);
	win.on('maximize', updateButtons);
	updateButtons();

	Keyboard.keydownOnce(['esc', 'alt'], (e: typeof KeyEvent) => {
		document.body.classList.toggle('paused');
	});
}
开发者ID:OlsonDev,项目名称:Synergy,代码行数:29,代码来源:titlebar.ts


示例4: showContextMenu

function showContextMenu(e) {
	e.preventDefault();

	const pid = parseInt(e.currentTarget.id);
	if (pid && typeof pid === 'number') {
		const menu = new remote.Menu();
		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.popup(remote.getCurrentWindow());
	}
}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:25,代码来源:processExplorerMain.ts


示例5: async

    getCookie: async(name: string) => {
        const value = {
            name
        };
        const cookies = remote.getCurrentWindow().webContents.session.cookies;

        if (!name) {
            return new Promise((resolve, reject) => {
                cookies.get({ url: axios.defaults.baseURL }, (error, cookies) => {
                    let string = '';

                    if (error) {
                        return resolve('');
                    }

                    for (let i = cookies.length; --i >= 0;) {
                        const item = cookies[i];
                        string += `${item.name}=${item.value} ;`;
                    }

                    resolve(string);
                });
            });
        }

        return new Promise((resolve, reject) => {
            cookies.get(value, (err, cookies) => {
                if (err) {
                    reject(err);
                } else {
                    resolve(cookies[0].value);
                }
            });
        });
    },
开发者ID:gjik911,项目名称:git_01,代码行数:35,代码来源:helper_20180805185804.ts


示例6: init

(function init() {
  const { getPersistentAsJson } = Electron.remote.require("./remote");
  const json = JSON.parse(getPersistentAsJson());
  const config = json.config as Config;
  store.mutations.resetConfig(config);

  try {
    const recentList = JSON.parse(localStorage.getItem("recentList") || "[]");
    if (
      recentList instanceof Array &&
      recentList.every(v => typeof v === "string")
    ) {
      store.mutations.resetRecentList(recentList);
    } else {
      console.warn("Failed to load recentList from localStorage");
    }
  } catch {
    console.warn("Failed to load recentList from localStorage");
  }

  Electron.ipcRenderer.on(
    "action",
    (_event: string, name: string, payload: any) => {
      (store.actions as any)[name](payload);
    }
  );
})();
开发者ID:wonderful-panda,项目名称:inazuma,代码行数:27,代码来源:index.ts


示例7: move

	async move(selector: string): TPromise<void> {
		const { x, y } = await this._getElementXY(selector);
		const webContents = electron.remote.getCurrentWebContents();
		webContents.sendInputEvent({ type: 'mouseMove', x, y } as any);

		await TPromise.timeout(100);
	}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:7,代码来源:driver.ts


示例8: function

    ready: function() {
        this.button = document.querySelector('.builtin-search-button') as HTMLButtonElement;
        this.button.addEventListener('click', () => {
            this.search(this.input.value);
        });

        this.body = document.querySelector('.builtin-search-body') as HTMLDivElement;
        this.body.classList.add('animated');
        if (this.displayed) {
            this.body.style.display = 'block';
        }

        this.matches = document.querySelector('.builtin-search-matches') as HTMLDivElement;

        remote.getCurrentWebContents().on('found-in-page', (event: Event, result: FoundInPage) => {
            if (this.requestId !== result.requestId) {
                return;
            }
            if (result.activeMatchOrdinal) {
                this.activeIdx = result.activeMatchOrdinal;
            }
            if (result.finalUpdate && result.matches) {
                this.setResult(this.activeIdx, result.matches);
            }
        });

        this.up_button = document.querySelector('.builtin-search-up') as HTMLButtonElement;
        this.up_button.addEventListener('click', () => this.searchNext(this.query, false));
        this.down_button = document.querySelector('.builtin-search-down') as HTMLButtonElement;
        this.down_button.addEventListener('click', () => this.searchNext(this.query, true));
        this.close_button = document.querySelector('.builtin-search-close') as HTMLButtonElement;
        this.close_button.addEventListener('click', () => this.dismiss());
    },
开发者ID:WondermSwift,项目名称:Shiba,代码行数:33,代码来源:builtin-search.ts


示例9: showCommitContextMenu

export function showCommitContextMenu(store: AppStore, commit: Commit) {
  const template = getCommitMenuTemplate(store, commit);
  if (template.length === 0) {
    return;
  }
  const menu = Menu.buildFromTemplate(template);
  menu.popup({ window: remote.getCurrentWindow() });
}
开发者ID:wonderful-panda,项目名称:inazuma,代码行数:8,代码来源:index.ts


示例10: function

 document.getElementById("max-btn").addEventListener("click", function (e) {
   var window: Electron.BrowserWindow = remote.getCurrentWindow();
   
   if(window.isMaximized())
     window.unmaximize();
   else
     window.maximize();        
 });
开发者ID:zsvanderlaan,项目名称:aurelia-electron-typescript,代码行数:8,代码来源:app-window.ts



注:本文中的electron.remote类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript electron.remote.BrowserWindow类代码示例发布时间:2022-05-25
下一篇:
TypeScript gitHubPublisher.GitHubPublisher类代码示例发布时间: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