forked from swiftwasm/JavaScriptKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
280 lines (259 loc) · 15.1 KB
/
Copy pathindex.html
File metadata and controls
280 lines (259 loc) · 15.1 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScriptKit - JSString</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="#relationships">Relationships</a><ul><li><a href="#relationships">Conforms To</a></li></ul></li><li><a href="#initializers">Initializers</a><ul><li class="initializer"><a href="#jsstring.init(_:)">init(_:)</a></li><li class="initializer"><a href="#jsstring.init(stringliteral:)">init(stringLiteral:)</a></li></ul></li><li><a href="#properties">Properties</a><ul><li class="variable"><a href="#jsstring.description">description</a></li></ul></li><li><a href="#methods">Methods</a><ul><li class="function"><a href="#jsstring.construct(from:)">construct(from:)</a></li><li class="function"><a href="#jsstring.jsvalue()">jsValue()</a></li></ul></li><li><a href="#operators">Operators</a><ul><li class="function"><a href="#jsstring.==">==</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Structure</small>
<code class="name">JSString</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">struct</span> <span class="type">JSString</span>: <span class="type">LosslessStringConvertible</span>, <span class="type">Equatable</span> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p><code>JSString</code> represents a string in JavaScript and supports bridging string between JavaScript and Swift.</p>
</div>
<div class="discussion">
<p>Conversion between <code>Swift.String</code> and <code>JSString</code> can be:</p>
<html><body><pre class="highlight"><code><span class="comment">// Convert `Swift.String` to `JSString`</span>
<span class="keyword">let</span> <span class="variable">jsString</span>: <span class="type">JSString</span> = ...
<span class="keyword">let</span> <span class="variable">swiftString</span>: <span class="type">String</span> = <span class="variable">String</span>(<span class="variable">jsString</span>)
<span class="comment">// Convert `JSString` to `Swift.String`</span>
<span class="keyword">let</span> <span class="variable">swiftString</span>: <span class="type">String</span> = ...
<span class="keyword">let</span> <span class="variable">jsString</span>: <span class="type">JSString</span> = <span class="variable">JSString</span>(<span class="variable">swiftString</span>)
</code></pre></body></html>
</div>
<section id="relationships">
<h2 hidden>Relationships</h2>
<figure>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %3 Pages: 1 -->
<svg width="1301pt" height="268pt"
viewBox="0.00 0.00 1300.77 268.35" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 264.3469)">
<title>%3</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-264.3469 1296.7682,-264.3469 1296.7682,4 -4,4"/>
<!-- JSString -->
<g id="node1" class="node structure current">
<title>JSString</title>
<g id="a_node1"><a xlink:href="/JavaScriptKit/JSString" xlink:title="JSString">
<path fill="none" stroke="#000000" stroke-width="3" d="M751.2908,-138.5683C751.2908,-138.5683 559.2908,-138.5683 559.2908,-138.5683 553.2908,-138.5683 547.2908,-132.5683 547.2908,-126.5683 547.2908,-126.5683 547.2908,-114.5683 547.2908,-114.5683 547.2908,-108.5683 553.2908,-102.5683 559.2908,-102.5683 559.2908,-102.5683 751.2908,-102.5683 751.2908,-102.5683 757.2908,-102.5683 763.2908,-108.5683 763.2908,-114.5683 763.2908,-114.5683 763.2908,-126.5683 763.2908,-126.5683 763.2908,-132.5683 757.2908,-138.5683 751.2908,-138.5683"/>
<text text-anchor="middle" x="655.2908" y="-116.8683" font-family="Menlo" font-size="14.00" fill="#000000">JSString</text>
</a>
</g>
</g>
<!-- ExpressibleByStringLiteral -->
<g id="node2" class="node unknown">
<title>ExpressibleByStringLiteral</title>
<path fill="none" stroke="#000000" d="M1113.609,-44.7481C1113.609,-44.7481 921.609,-44.7481 921.609,-44.7481 915.609,-44.7481 909.609,-38.7481 909.609,-32.7481 909.609,-32.7481 909.609,-20.7481 909.609,-20.7481 909.609,-14.7481 915.609,-8.7481 921.609,-8.7481 921.609,-8.7481 1113.609,-8.7481 1113.609,-8.7481 1119.609,-8.7481 1125.609,-14.7481 1125.609,-20.7481 1125.609,-20.7481 1125.609,-32.7481 1125.609,-32.7481 1125.609,-38.7481 1119.609,-44.7481 1113.609,-44.7481"/>
<text text-anchor="middle" x="1017.609" y="-23.0481" font-family="Menlo" font-size="14.00" fill="#000000">ExpressibleByStringLiteral</text>
</g>
<!-- JSString->ExpressibleByStringLiteral -->
<g id="edge1" class="edge conformsTo">
<title>JSString->ExpressibleByStringLiteral</title>
<path fill="none" stroke="#000000" d="M725.1494,-102.4788C786.0497,-86.709 874.3484,-63.8446 937.9733,-47.3693"/>
<polygon fill="#000000" stroke="#000000" points="939.1615,-50.6771 947.9648,-44.782 937.4067,-43.9006 939.1615,-50.6771"/>
</g>
<!-- Equatable -->
<g id="node3" class="node unknown">
<title>Equatable</title>
<path fill="none" stroke="#000000" d="M445.6007,-36C445.6007,-36 253.6007,-36 253.6007,-36 247.6007,-36 241.6007,-30 241.6007,-24 241.6007,-24 241.6007,-12 241.6007,-12 241.6007,-6 247.6007,0 253.6007,0 253.6007,0 445.6007,0 445.6007,0 451.6007,0 457.6007,-6 457.6007,-12 457.6007,-12 457.6007,-24 457.6007,-24 457.6007,-30 451.6007,-36 445.6007,-36"/>
<text text-anchor="middle" x="349.6007" y="-14.3" font-family="Menlo" font-size="14.00" fill="#000000">Equatable</text>
</g>
<!-- JSString->Equatable -->
<g id="edge2" class="edge conformsTo">
<title>JSString->Equatable</title>
<path fill="none" stroke="#000000" d="M601.3432,-102.4672C548.7121,-84.8079 468.6635,-57.9492 413.0141,-39.2771"/>
<polygon fill="#000000" stroke="#000000" points="413.8594,-35.869 403.2654,-36.0061 411.6326,-42.5054 413.8594,-35.869"/>
</g>
<!-- ConvertibleToJSValue -->
<g id="node4" class="node protocol">
<title>ConvertibleToJSValue</title>
<g id="a_node4"><a xlink:href="/JavaScriptKit/ConvertibleToJSValue" xlink:title="ConvertibleToJSValue">
<path fill="none" stroke="#000000" d="M204,-170.5843C204,-170.5843 12,-170.5843 12,-170.5843 6,-170.5843 0,-164.5843 0,-158.5843 0,-158.5843 0,-146.5843 0,-146.5843 0,-140.5843 6,-134.5843 12,-134.5843 12,-134.5843 204,-134.5843 204,-134.5843 210,-134.5843 216,-140.5843 216,-146.5843 216,-146.5843 216,-158.5843 216,-158.5843 216,-164.5843 210,-170.5843 204,-170.5843"/>
<text text-anchor="middle" x="108" y="-148.8843" font-family="Menlo" font-size="14.00" fill="#000000">ConvertibleToJSValue</text>
</a>
</g>
</g>
<!-- JSString->ConvertibleToJSValue -->
<g id="edge3" class="edge conformsTo">
<title>JSString->ConvertibleToJSValue</title>
<path fill="none" stroke="#000000" d="M547.1638,-126.8936C454.7396,-132.3003 321.9642,-140.0676 226.6372,-145.6441"/>
<polygon fill="#000000" stroke="#000000" points="226.1482,-142.1666 216.3697,-146.2448 226.5571,-149.1547 226.1482,-142.1666"/>
</g>
<!-- LosslessStringConvertible -->
<g id="node5" class="node unknown">
<title>LosslessStringConvertible</title>
<path fill="none" stroke="#000000" d="M1280.7682,-182.7551C1280.7682,-182.7551 1088.7682,-182.7551 1088.7682,-182.7551 1082.7682,-182.7551 1076.7682,-176.7551 1076.7682,-170.7551 1076.7682,-170.7551 1076.7682,-158.7551 1076.7682,-158.7551 1076.7682,-152.7551 1082.7682,-146.7551 1088.7682,-146.7551 1088.7682,-146.7551 1280.7682,-146.7551 1280.7682,-146.7551 1286.7682,-146.7551 1292.7682,-152.7551 1292.7682,-158.7551 1292.7682,-158.7551 1292.7682,-170.7551 1292.7682,-170.7551 1292.7682,-176.7551 1286.7682,-182.7551 1280.7682,-182.7551"/>
<text text-anchor="middle" x="1184.7682" y="-161.0551" font-family="Menlo" font-size="14.00" fill="#000000">LosslessStringConvertible</text>
</g>
<!-- JSString->LosslessStringConvertible -->
<g id="edge4" class="edge conformsTo">
<title>JSString->LosslessStringConvertible</title>
<path fill="none" stroke="#000000" d="M763.3963,-129.5901C851.4383,-136.9375 975.5701,-147.2968 1066.2977,-154.8683"/>
<polygon fill="#000000" stroke="#000000" points="1066.1002,-158.3639 1076.3566,-155.7078 1066.6824,-151.3881 1066.1002,-158.3639"/>
</g>
<!-- ConstructibleFromJSValue -->
<g id="node6" class="node protocol">
<title>ConstructibleFromJSValue</title>
<g id="a_node6"><a xlink:href="/JavaScriptKit/ConstructibleFromJSValue" xlink:title="ConstructibleFromJSValue">
<path fill="none" stroke="#000000" d="M724.5289,-260.3469C724.5289,-260.3469 532.5289,-260.3469 532.5289,-260.3469 526.5289,-260.3469 520.5289,-254.3469 520.5289,-248.3469 520.5289,-248.3469 520.5289,-236.3469 520.5289,-236.3469 520.5289,-230.3469 526.5289,-224.3469 532.5289,-224.3469 532.5289,-224.3469 724.5289,-224.3469 724.5289,-224.3469 730.5289,-224.3469 736.5289,-230.3469 736.5289,-236.3469 736.5289,-236.3469 736.5289,-248.3469 736.5289,-248.3469 736.5289,-254.3469 730.5289,-260.3469 724.5289,-260.3469"/>
<text text-anchor="middle" x="628.5289" y="-238.6469" font-family="Menlo" font-size="14.00" fill="#000000">ConstructibleFromJSValue</text>
</a>
</g>
</g>
<!-- JSString->ConstructibleFromJSValue -->
<g id="edge5" class="edge conformsTo">
<title>JSString->ConstructibleFromJSValue</title>
<path fill="none" stroke="#000000" d="M651.2843,-138.7998C646.9092,-158.7085 639.8471,-190.8442 634.7498,-214.039"/>
<polygon fill="#000000" stroke="#000000" points="631.2908,-213.4726 632.5628,-223.9908 638.1277,-214.9751 631.2908,-213.4726"/>
</g>
</g>
</svg>
<figcaption hidden>Inheritance graph for JSString.</figcaption>
</figure>
<h3>Conforms To</h3>
<dl>
<dt class="protocol"><code><a href="/JavaScriptKit/ConstructibleFromJSValue">ConstructibleFromJSValue</a></code></dt>
<dd><p>Types conforming to this protocol can be constructed from <code>JSValue</code>.</p>
</dd>
<dt class="protocol"><code><a href="/JavaScriptKit/ConvertibleToJSValue">ConvertibleToJSValue</a></code></dt>
<dd><p>Objects that can be converted to a JavaScript value, preferably in a lossless manner.</p>
</dd>
<dt class="unknown"><code>Equatable</code></dt>
<dt class="unknown"><code>ExpressibleByStringLiteral</code></dt>
<dt class="unknown"><code>LosslessStringConvertible</code></dt>
</dl>
</section>
<section id="initializers">
<h2>Initializers</h2>
<div role="article" class="initializer" id="jsstring.init(_:)">
<h3>
<code><a href="#jsstring.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">stringValue</span>: <span class="type">String</span>) </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Instantiate a new <code>JSString</code> with given Swift.String.</p>
</div>
</div>
<div role="article" class="initializer" id="jsstring.init(stringliteral:)">
<h3>
<code><a href="#jsstring.init(stringliteral:)">init(stringLiteral:)</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">init</span>(<span class="variable">stringLiteral</span> <span class="variable">value</span>: <span class="type">String</span>) </body></html></code></pre>
</div>
</div>
</section>
<section id="properties">
<h2>Properties</h2>
<div role="article" class="variable" id="jsstring.description">
<h3>
<code><a href="#jsstring.description">description</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">description</span>: <span class="type">String</span> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>A Swift representation of this <code>JSString</code>.
Note that this accessor may copy the JS string value into Swift side memory.</p>
</div>
</div>
</section>
<section id="methods">
<h2>Methods</h2>
<div role="article" class="function" id="jsstring.construct(from:)">
<h3>
<code><a href="#jsstring.construct(from:)">construct(from:)</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">func</span> <span class="function">construct</span>(<span class="variable">from</span> <span class="variable">value</span>: <a href="/JavaScriptKit/JSValue"><span class="type">JSValue</span></a>) -> <a href="/JavaScriptKit/JSString"><span class="type">JSString</span></a>? </body></html></code></pre>
</div>
</div>
<div role="article" class="function" id="jsstring.jsvalue()">
<h3>
<code><a href="#jsstring.jsvalue()">jsValue()</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">jsValue</span>() -> <a href="/JavaScriptKit/JSValue"><span class="type">JSValue</span></a> </body></html></code></pre>
</div>
</div>
</section>
<section id="operators">
<h2>Operators</h2>
<div role="article" class="function" id="jsstring.==">
<h3>
<code><a href="#jsstring.==">==</a></code>
</h3>
<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">func</span> == (<span class="variable">lhs</span>: <a href="/JavaScriptKit/JSString"><span class="type">JSString</span></a>, <span class="variable">rhs</span>: <a href="/JavaScriptKit/JSString"><span class="type">JSString</span></a>) -> <span class="type">Bool</span> </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Returns a Boolean value indicating whether two strings are equal values.</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>lhs</th>
<td><code class="type">JSString</code></td>
<td><p>A string to compare.</p>
</td>
</tr>
<tr>
<th>rhs</th>
<td><code class="type">JSString</code></td>
<td><p>Another string to compare.</p>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2022-03-24T11:42:53+0000">March 24, 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>