mirror of
https://github.com/Mintplex-Labs/nut.js.git
synced 2026-07-21 01:15:22 -04:00
356 lines
18 KiB
HTML
356 lines
18 KiB
HTML
<!doctype html>
|
|
<html class="default no-js">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<title>Keyboard | @nut-tree/nut-js</title>
|
|
<meta name="description" content="Documentation for @nut-tree/nut-js">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="../assets/css/main.css">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div class="tsd-page-toolbar">
|
|
<div class="container">
|
|
<div class="table-wrap">
|
|
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
|
|
<div class="field">
|
|
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
|
<input id="tsd-search-field" type="text" />
|
|
</div>
|
|
<ul class="results">
|
|
<li class="state loading">Preparing search index...</li>
|
|
<li class="state failure">The search index is not available</li>
|
|
</ul>
|
|
<a href="../index.html" class="title">@nut-tree/nut-js</a>
|
|
</div>
|
|
<div class="table-cell" id="tsd-widgets">
|
|
<div id="tsd-filter">
|
|
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
|
|
<div class="tsd-filter-group">
|
|
<div class="tsd-select" id="tsd-filter-visibility">
|
|
<span class="tsd-select-label">All</span>
|
|
<ul class="tsd-select-list">
|
|
<li data-value="public">Public</li>
|
|
<li data-value="protected">Public/Protected</li>
|
|
<li data-value="private" class="selected">All</li>
|
|
</ul>
|
|
</div>
|
|
<input type="checkbox" id="tsd-filter-inherited" checked />
|
|
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
|
|
</div>
|
|
</div>
|
|
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="tsd-page-title">
|
|
<div class="container">
|
|
<ul class="tsd-breadcrumb">
|
|
<li>
|
|
<a href="../globals.html">Globals</a>
|
|
</li>
|
|
<li>
|
|
<a href="keyboard.html">Keyboard</a>
|
|
</li>
|
|
</ul>
|
|
<h1>Class Keyboard</h1>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="container container-main">
|
|
<div class="row">
|
|
<div class="col-8 col-content">
|
|
<section class="tsd-panel tsd-comment">
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p><a href="keyboard.html">Keyboard</a> class provides methods to emulate keyboard input</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<section class="tsd-panel tsd-hierarchy">
|
|
<h3>Hierarchy</h3>
|
|
<ul class="tsd-hierarchy">
|
|
<li>
|
|
<span class="target">Keyboard</span>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-index-group">
|
|
<h2>Index</h2>
|
|
<section class="tsd-panel tsd-index-panel">
|
|
<div class="tsd-index-content">
|
|
<section class="tsd-index-section ">
|
|
<h3>Constructors</h3>
|
|
<ul class="tsd-index-list">
|
|
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="keyboard.html#constructor" class="tsd-kind-icon">constructor</a></li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-index-section ">
|
|
<h3>Methods</h3>
|
|
<ul class="tsd-index-list">
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="keyboard.html#presskey" class="tsd-kind-icon">press<wbr>Key</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="keyboard.html#releasekey" class="tsd-kind-icon">release<wbr>Key</a></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="keyboard.html#type" class="tsd-kind-icon">type</a></li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-index-section ">
|
|
<h3>Object literals</h3>
|
|
<ul class="tsd-index-list">
|
|
<li class="tsd-kind-object-literal tsd-parent-kind-class"><a href="keyboard.html#config" class="tsd-kind-icon">config</a></li>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-member-group ">
|
|
<h2>Constructors</h2>
|
|
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
|
|
<a name="constructor" class="tsd-anchor"></a>
|
|
<h3>constructor</h3>
|
|
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">new <wbr>Keyboard<span class="tsd-signature-symbol">(</span>nativeAdapter<span class="tsd-signature-symbol">: </span><a href="nativeadapter.html" class="tsd-signature-type">NativeAdapter</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="keyboard.html" class="tsd-signature-type">Keyboard</a></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/nut-tree/nut.js/blob/3aa660c/lib/keyboard.class.ts#L24">keyboard.class.ts:24</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p><a href="keyboard.html">Keyboard</a> class constructor</p>
|
|
</div>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5>nativeAdapter: <a href="nativeadapter.html" class="tsd-signature-type">NativeAdapter</a></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p><a href="nativeadapter.html">NativeAdapter</a> instance which bundles access to mouse, keyboard and clipboard</p>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <a href="keyboard.html" class="tsd-signature-type">Keyboard</a></h4>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-member-group ">
|
|
<h2>Methods</h2>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="presskey" class="tsd-anchor"></a>
|
|
<h3>press<wbr>Key</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">press<wbr>Key<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>keys<span class="tsd-signature-symbol">: </span><a href="../enums/key.html" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="keyboard.html" class="tsd-signature-type">Keyboard</a><span class="tsd-signature-symbol">></span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/nut-tree/nut.js/blob/3aa660c/lib/keyboard.class.ts#L73">keyboard.class.ts:73</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p><a href="keyboard.html#presskey">pressKey</a> presses and holds a single <a href="../enums/key.html">Key</a> for <a href="../enums/key.html">Key</a> combinations
|
|
Modifier <a href="../enums/key.html">Key</a>s are to be given in "natural" ordering, so first modifier <a href="../enums/key.html">Key</a>s, followed by the <a href="../enums/key.html">Key</a> to press</p>
|
|
</div>
|
|
<dl class="tsd-comment-tags">
|
|
<dt>example</dt>
|
|
<dd><pre><code class="language-typescript"> <span class="hljs-comment">// Will press and hold key combination STRG + V</span>
|
|
<span class="hljs-keyword">await</span> keyboard.pressKey(Key.STRG, Key.A);</code></pre>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>keys: <a href="../enums/key.html" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol">[]</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>Array of <a href="../enums/key.html">Key</a>s to press and hold</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="keyboard.html" class="tsd-signature-type">Keyboard</a><span class="tsd-signature-symbol">></span></h4>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="releasekey" class="tsd-anchor"></a>
|
|
<h3>release<wbr>Key</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">release<wbr>Key<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>keys<span class="tsd-signature-symbol">: </span><a href="../enums/key.html" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="keyboard.html" class="tsd-signature-type">Keyboard</a><span class="tsd-signature-symbol">></span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/nut-tree/nut.js/blob/3aa660c/lib/keyboard.class.ts#L95">keyboard.class.ts:95</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p><a href="keyboard.html#presskey">pressKey</a> releases a single <a href="../enums/key.html">Key</a> for <a href="../enums/key.html">Key</a> combinations
|
|
Modifier <a href="../enums/key.html">Key</a>s are to be given in "natural" ordering, so first modifier <a href="../enums/key.html">Key</a>s, followed by the <a href="../enums/key.html">Key</a> to press</p>
|
|
</div>
|
|
<dl class="tsd-comment-tags">
|
|
<dt>example</dt>
|
|
<dd><pre><code class="language-typescript"> <span class="hljs-comment">// Will release key combination STRG + V</span>
|
|
<span class="hljs-keyword">await</span> keyboard.releaseKey(Key.STRG, Key.A);</code></pre>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>keys: <a href="../enums/key.html" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol">[]</span></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>Array of <a href="../enums/key.html">Key</a>s to release</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="keyboard.html" class="tsd-signature-type">Keyboard</a><span class="tsd-signature-symbol">></span></h4>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
<a name="type" class="tsd-anchor"></a>
|
|
<h3>type</h3>
|
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
<li class="tsd-signature tsd-kind-icon">type<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>input<span class="tsd-signature-symbol">: </span><a href="../globals.html#stringorkey" class="tsd-signature-type">StringOrKey</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="keyboard.html" class="tsd-signature-type">Keyboard</a><span class="tsd-signature-symbol">></span></li>
|
|
</ul>
|
|
<ul class="tsd-descriptions">
|
|
<li class="tsd-description">
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/nut-tree/nut.js/blob/3aa660c/lib/keyboard.class.ts#L44">keyboard.class.ts:44</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p><a href="keyboard.html#type">type</a> types a sequence of {@link String} or single <a href="../enums/key.html">Key</a>s via system keyboard</p>
|
|
</div>
|
|
<dl class="tsd-comment-tags">
|
|
<dt>example</dt>
|
|
<dd><pre><code class="language-typescript"> <span class="hljs-keyword">await</span> keyboard.type(Key.A, Key.S, Key.D, Key.F);
|
|
<span class="hljs-keyword">await</span> keyboard.type(<span class="hljs-string">"Hello, world!"</span>);</code></pre>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
<ul class="tsd-parameters">
|
|
<li>
|
|
<h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>input: <a href="../globals.html#stringorkey" class="tsd-signature-type">StringOrKey</a></h5>
|
|
<div class="tsd-comment tsd-typography">
|
|
<p>Sequence of {@link String} or <a href="../enums/key.html">Key</a> to type</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="keyboard.html" class="tsd-signature-type">Keyboard</a><span class="tsd-signature-symbol">></span></h4>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</section>
|
|
<section class="tsd-panel-group tsd-member-group ">
|
|
<h2>Object literals</h2>
|
|
<section class="tsd-panel tsd-member tsd-kind-object-literal tsd-parent-kind-class">
|
|
<a name="config" class="tsd-anchor"></a>
|
|
<h3>config</h3>
|
|
<div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div>
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/nut-tree/nut.js/blob/3aa660c/lib/keyboard.class.ts#L19">keyboard.class.ts:19</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Config object for <a href="keyboard.html">Keyboard</a> class</p>
|
|
</div>
|
|
</div>
|
|
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal">
|
|
<a name="config.autodelayms" class="tsd-anchor"></a>
|
|
<h3>auto<wbr>Delay<wbr>Ms</h3>
|
|
<div class="tsd-signature tsd-kind-icon">auto<wbr>Delay<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 300</span></div>
|
|
<aside class="tsd-sources">
|
|
<ul>
|
|
<li>Defined in <a href="https://github.com/nut-tree/nut.js/blob/3aa660c/lib/keyboard.class.ts#L23">keyboard.class.ts:23</a></li>
|
|
</ul>
|
|
</aside>
|
|
<div class="tsd-comment tsd-typography">
|
|
<div class="lead">
|
|
<p>Configures the delay between single key events</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
</section>
|
|
</div>
|
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
<nav class="tsd-navigation primary">
|
|
<ul>
|
|
<li class="globals ">
|
|
<a href="../globals.html"><em>Globals</em></a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<nav class="tsd-navigation secondary menu-sticky">
|
|
<ul class="before-current">
|
|
</ul>
|
|
<ul class="current">
|
|
<li class="current tsd-kind-class">
|
|
<a href="keyboard.html" class="tsd-kind-icon">Keyboard</a>
|
|
<ul>
|
|
<li class=" tsd-kind-constructor tsd-parent-kind-class">
|
|
<a href="keyboard.html#constructor" class="tsd-kind-icon">constructor</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="keyboard.html#presskey" class="tsd-kind-icon">press<wbr>Key</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="keyboard.html#releasekey" class="tsd-kind-icon">release<wbr>Key</a>
|
|
</li>
|
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
<a href="keyboard.html#type" class="tsd-kind-icon">type</a>
|
|
</li>
|
|
<li class=" tsd-kind-object-literal tsd-parent-kind-class">
|
|
<a href="keyboard.html#config" class="tsd-kind-icon">config</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="after-current">
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
<div class="container">
|
|
<h2>Legend</h2>
|
|
<div class="tsd-legend-group">
|
|
<ul class="tsd-legend">
|
|
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
|
|
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
|
|
</ul>
|
|
<ul class="tsd-legend">
|
|
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
|
|
</ul>
|
|
<ul class="tsd-legend">
|
|
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
|
|
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
<div class="overlay"></div>
|
|
<script src="../assets/js/main.js"></script>
|
|
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
|
|
</body>
|
|
</html> |