当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript remote.getCurrentWebContents方法代码示例

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


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

示例1: 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

示例2: 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

示例3: _click

	private async _click(selector: string, clickCount: number, xoffset?: number, yoffset?: number): TPromise<void> {
		const { x, y } = await this._getElementXY(selector, xoffset, yoffset);
		const webContents = electron.remote.getCurrentWebContents();
		webContents.sendInputEvent({ type: 'mouseDown', x, y, button: 'left', clickCount } as any);
		webContents.sendInputEvent({ type: 'mouseUp', x, y, button: 'left', clickCount } as any);

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

示例4: BrowserWindow

var BrowserWindow = remote.BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
win.loadURL('https://github.com');

remote.getCurrentWindow().on('close', () => {
	// blabla...
});

remote.getCurrentWindow().capturePage(buf => {
	fs.writeFile('/tmp/screenshot.png', buf, err => {
		console.log(err);
	});
});

remote.getCurrentWebContents().print();

remote.getCurrentWindow().capturePage(buf => {
	remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => {
		console.log(err);
	});
});

// web-frame
// https://github.com/atom/electron/blob/master/docs/api/web-frame.md

webFrame.setZoomFactor(2);
console.log(webFrame.getZoomFactor());

webFrame.setZoomLevel(200);
console.log(webFrame.getZoomLevel());
开发者ID:longlho,项目名称:DefinitelyTyped,代码行数:30,代码来源:github-electron-renderer-tests.ts

示例5: ready

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

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

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

        remote.getCurrentWebContents().on('found-in-page', (_: 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');
        this.up_button.addEventListener('click', () => this.searchNext(this.query, false));
        this.down_button = document.querySelector('.builtin-search-down');
        this.down_button.addEventListener('click', () => this.searchNext(this.query, true));
开发者ID:Sheshouzuo,项目名称:Shiba,代码行数:30,代码来源:builtin-search.ts

示例6:

 'nyaovim:open-devtools': (mode: 'right' | 'bottom' | 'undocked' | 'detach') => {
     const contents = remote.getCurrentWebContents();
     contents.openDevTools({mode});
 },
开发者ID:haifengkao,项目名称:NyaoVim-Unofficial,代码行数:4,代码来源:nyaovim-app.ts

示例7: searchNext

            return;
        }

        // Note: When this.query === word
        this.searchNext(word, true);
    },

    searchNext(text: string, forward: boolean) {
        if (text === '') {
            return;
        }
        const options = {
            forward,
            findNext: true,
        };
        this.requestId = remote.getCurrentWebContents().findInPage(text, options);
        this.focusOnInput();
    },

    stopSearch: function() {
        if (!this.searching) {
            return;
        }
        this.setResult(0, 0);
        remote.getCurrentWebContents().stopFindInPage('clearSelection');
        this.searching = false;
        this.query = '';
        this.requestId = undefined;
        this.activeIdx = 0;
    },
开发者ID:WondermSwift,项目名称:Shiba,代码行数:30,代码来源:builtin-search.ts


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