Kind: Low-level provider
1npm i @nut-tree/bolt
Attention: @nut-tree/bolt
is only available to sponsors of nut.js.
In case you want to get access to it, please consult the sponsoring profile
@nut-tree/bolt
is an alternative low-level provider for nut.js.
It can replace the default @nut-tree/nut-js
low-level provider, @nut-tree/libnut
, and comes with additional features.
The most significant features at the time of writing are:
@nut-tree/bolt
exports a set of functions for fine-grained control over each low-level provider.
useBoltKeyboard()
: Replaces the default keyboard provider with @nut-tree/bolt
's keyboard implementationuseBoltMouse()
: Replaces the default mouse provider with @nut-tree/bolt
's mouse implementationuseBoltScreen()
: Replaces the default screen provider with @nut-tree/bolt
's screen implementationuseBoltWindows()
: Replaces the default window provider with @nut-tree/bolt
's window implementationuseBoltWindowFinder()
: Registers the @nut-tree/bolt
window finder implementation1const { screen, imageResource } = require("@nut-tree/nut-js"); 2const { useBoltKeyboard } = require("@nut-tree/bolt"); 3 4useBoltKeyboard(); // From this point on all keyboard interactions will be handled by @nut-tree/bolt 5 6(async () => { 7 const img = await screen.findAll(imageResource("...")); 8})();
In case you want to use all available @nut-tree/bolt
providers, you can use the useBolt()
function:
1const { screen, imageResource } = require("@nut-tree/nut-js"); 2const { useBolt } = require("@nut-tree/bolt"); 3 4useBolt(); // Now we have all @nut-tree/bolt providers set up, including the window finder 5 6(async () => { 7 const wnd = await screen.find(windowWithTitle(/some.*regex/)); 8})();
© 2023