Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
192 lines (170 loc) · 7.85 KB

File metadata and controls

192 lines (170 loc) · 7.85 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScriptKit - JSThrowingFunction</title>
<link rel="stylesheet" type="text/css" href="/JavaScriptKit/all.css" media="all" />
</head>
<body>
<header>
<a href="/JavaScriptKit">
<strong>
JavaScriptKit
</strong>
<span>Documentation</span>
</a>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#initializers">Initializers</a><ul><li class="initializer"><a href="#jsthrowingfunction.init(_:)">init(_:​)</a></li></ul></li><li><a href="#methods">Methods</a><ul><li class="function"><a href="#jsthrowingfunction.callasfunction(this:arguments:)">call​AsFunction(this:​arguments:​)</a></li><li class="function"><a href="#jsthrowingfunction.callasfunction(this:_:)">call​AsFunction(this:​_:​)</a></li><li class="function"><a href="#jsthrowingfunction.new(arguments:)">new(arguments:​)</a></li><li class="function"><a href="#jsthrowingfunction.new(_:)">new(_:​)</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Class</small>
<code class="name">JSThrowing​Function</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">class</span> <span class="type">JSThrowingFunction</span> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>A <code>JSFunction</code> wrapper that enables throwing function calls.
Exceptions produced by JavaScript functions will be thrown as <code>JSValue</code>.</p>
</div>
<section id="initializers">
<h2>Initializers</h2>
<div role="article" class="initializer" id="jsthrowingfunction.init(_:)">
<h3>
<code><a href="#jsthrowingfunction.init(_:)">init(_:​)</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">init</span>(<span class="keyword">_</span> <span class="variable">base</span>: <a href="/JavaScriptKit/JSFunction"><span class="type">JSFunction</span></a>) </body></html></code></pre>
</div>
</div>
</section>
<section id="methods">
<h2>Methods</h2>
<div role="article" class="function" id="jsthrowingfunction.callasfunction(this:arguments:)">
<h3>
<code><a href="#jsthrowingfunction.callasfunction(this:arguments:)">call​AsFunction(this:​arguments:​)</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="attribute">@</span><span class="attribute">discardableResult</span>
<span class="keyword">public</span> <span class="keyword">func</span> <span class="function">callAsFunction</span>(<span class="variable">this</span>: <a href="/JavaScriptKit/JSObject"><span class="type">JSObject</span></a>? = <span class="keyword">nil</span>, <span class="variable">arguments</span>: [<a href="/JavaScriptKit/ConvertibleToJSValue"><span class="type">ConvertibleToJSValue</span></a>]) <span class="keyword">throws</span> -&gt; <a href="/JavaScriptKit/JSValue"><span class="type">JSValue</span></a> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Call this function with given <code>arguments</code> and binding given <code>this</code> as context.</p>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>this</th>
<td><code class="type">JSObject?</code></td>
<td><p>The value to be passed as the <code>this</code> parameter to this function.</p>
</td>
</tr>
<tr>
<th>arguments</th>
<td><code class="type">[Convertible​ToJSValue]</code></td>
<td><p>Arguments to be passed to this function.</p>
</td>
</tr>
</tbody>
</table>
<h4>Returns</h4>
<p>The result of this call.</p>
</div>
<div role="article" class="function" id="jsthrowingfunction.callasfunction(this:_:)">
<h3>
<code><a href="#jsthrowingfunction.callasfunction(this:_:)">call​AsFunction(this:​_:​)</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="attribute">@</span><span class="attribute">discardableResult</span>
<span class="keyword">public</span> <span class="keyword">func</span> <span class="function">callAsFunction</span>(<span class="variable">this</span>: <a href="/JavaScriptKit/JSObject"><span class="type">JSObject</span></a>? = <span class="keyword">nil</span>, <span class="keyword">_</span> <span class="variable">arguments</span>: <a href="/JavaScriptKit/ConvertibleToJSValue"><span class="type">ConvertibleToJSValue</span></a>...) <span class="keyword">throws</span> -&gt; <a href="/JavaScriptKit/JSValue"><span class="type">JSValue</span></a> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>A variadic arguments version of <code>callAsFunction</code>.</p>
</div>
</div>
<div role="article" class="function" id="jsthrowingfunction.new(arguments:)">
<h3>
<code><a href="#jsthrowingfunction.new(arguments:)">new(arguments:​)</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">func</span> <span class="function">new</span>(<span class="variable">arguments</span>: [<a href="/JavaScriptKit/ConvertibleToJSValue"><span class="type">ConvertibleToJSValue</span></a>]) <span class="keyword">throws</span> -&gt; <a href="/JavaScriptKit/JSObject"><span class="type">JSObject</span></a> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Instantiate an object from this function as a throwing constructor.</p>
</div>
<div class="discussion">
<p>Guaranteed to return an object because either:</p>
<ul>
<li>
<p>a. the constructor explicitly returns an object, or</p>
</li>
<li>
<p>b. the constructor returns nothing, which causes JS to return the <code>this</code> value, or</p>
</li>
<li>
<p>c. the constructor returns undefined, null or a non-object, in which case JS also returns <code>this</code>.</p>
</li>
</ul>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>arguments</th>
<td><code class="type">[Convertible​ToJSValue]</code></td>
<td><p>Arguments to be passed to this constructor function.</p>
</td>
</tr>
</tbody>
</table>
<h4>Returns</h4>
<p>A new instance of this constructor.</p>
</div>
<div role="article" class="function" id="jsthrowingfunction.new(_:)">
<h3>
<code><a href="#jsthrowingfunction.new(_:)">new(_:​)</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">func</span> <span class="function">new</span>(<span class="keyword">_</span> <span class="variable">arguments</span>: <a href="/JavaScriptKit/ConvertibleToJSValue"><span class="type">ConvertibleToJSValue</span></a>...) <span class="keyword">throws</span> -&gt; <a href="/JavaScriptKit/JSObject"><span class="type">JSObject</span></a> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>A variadic arguments version of <code>new</code>.</p>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2022-02-22T15:19:50+0000">February 22, 2022</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-rc.1</span>.
</p>
</footer>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.