@aabuhijleh/forcefocus 中文文档教程
forcefocus
允许您从 Windows 中的其他窗口窃取焦点的节点模块。
Microsoft 更改了 SetFocus() 仅允许应用程序将焦点授予其他窗口(如果它当前持有焦点)。 如果没有焦点的应用程序试图获取它,任务栏将只是闪烁而不是聚焦窗口。 这些改动很可能是为了提升用户体验,让用户不会因为重点应用的突然切换而受到干扰。
该模块绕过了 SetFocus() 中的限制并允许任何窗口窃取焦点。
它在其他平台上重用了 Electron 内置的焦点。
Installation
通过运行安装 forcefocus
:
$ npm install --save forcefocus
win、mac 和 linux 的本机二进制文件是在安装模块时预先构建和下载的。
Documentation
forcefocus.focusWindow(window)
种类:forcefocus
的静态方法 总结:强制关注窗口
访问: public
Param | Type | Description |
---|---|---|
window | BrowserWindow | Window to focus |
Example
const forceFocus = require('forcefocus');
const currentWindow = require('electron').remote.getCurrentWindow();
forceFocus.focusWindow(currentWindow);
Example application
示例应用程序位于 /example/
目录,通过运行启动它:
$ npm run example
Contribute
随时为这个模块做贡献。
在提交 PR 之前,请确保 linter 运行时没有任何警告:
$ npm run lint
License
该项目已获得 Apache 2.0 许可。
forcefocus
Node module that allows you to steal focus from other windows in Windows.
Microsoft changed the implementation of SetFocus() to only allow an app to grant focus to other windows if it currenly holds the focus. If an app that does not have the focus tries to take it, the taskbar will just flash rather than focusing the window. These changes was probably done to improve the user experience, so users would not be disturbed by the focused application suddenly switching.
This module circumvents the restrictions in SetFocus() and allows any window to steal the focus.
It reuses the Electron built-in focus on other platforms.
Installation
Install forcefocus
by running:
$ npm install --save forcefocus
Native binaries for win, mac and linux are prebuilt and downloaded when the module is installed.
Documentation
forcefocus.focusWindow(window)
Kind: static method of forcefocus
Summary: Force focus on a Window
Access: public
Param | Type | Description |
---|---|---|
window | BrowserWindow | Window to focus |
Example
const forceFocus = require('forcefocus');
const currentWindow = require('electron').remote.getCurrentWindow();
forceFocus.focusWindow(currentWindow);
Example application
An example application is located in the /example/
dir, start it by running:
$ npm run example
Contribute
Feel free to contribute to this module.
Before submitting a PR, please make sure that the linter runs without any warning:
$ npm run lint
License
The project is licensed under the Apache 2.0 license.
你可能也喜欢
- 103-breads 中文文档教程
- @1023-ventures/piral-cli-rupel-react-codegen 中文文档教程
- @200kph/moar-types 中文文档教程
- @36node/template-sdk 中文文档教程
- @4geit/rct-social-buttons-component 中文文档教程
- @537/spawn 中文文档教程
- @7oussem/react-native-couchbase-lite 中文文档教程
- @8base-react/file-input 中文文档教程
- @9db/node-server 中文文档教程
- @abcpros/bitcore-lib 中文文档教程