Skip to content

Commit d29bc2f

Browse files
committed
update docs onee last time
1 parent cccba37 commit d29bc2f

File tree

5 files changed

+68
-20
lines changed

5 files changed

+68
-20
lines changed

docs/theindex.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ <h1 class="title">Index</h1>
289289
<li><a class="reference external"
290290
data-doc-search-tag="webui: elementName(e: Event): string" href="webui.html#elementName%2CEvent">webui: elementName(e: Event): string</a></li>
291291
</ul></dd>
292+
<dt><a name="evalJs" href="#evalJs"><span>evalJs:</span></a></dt><dd><ul class="simple">
293+
<li><a class="reference external"
294+
data-doc-search-tag="webui: evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult" href="webui.html#evalJs%2CWindow%2Cstring%2Cint">webui: evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult</a></li>
295+
</ul></dd>
292296
<dt><a name="Event" href="#Event"><span>Event:</span></a></dt><dd><ul class="simple">
293297
<li><a class="reference external"
294298
data-doc-search-tag="webui: Event" href="webui.html#Event">webui: Event</a></li>
@@ -461,7 +465,7 @@ <h1 class="title">Index</h1>
461465
</ul></dd>
462466
<dt><a name="newScript" href="#newScript"><span>newScript:</span></a></dt><dd><ul class="simple">
463467
<li><a class="reference external"
464-
data-doc-search-tag="webui: newScript(script: string; timeout: int): Script" href="webui.html#newScript%2Cstring%2Cint">webui: newScript(script: string; timeout: int): Script</a></li>
468+
data-doc-search-tag="webui: newScript(script: string; timeout: int = 0): Script" href="webui.html#newScript%2Cstring%2Cint">webui: newScript(script: string; timeout: int = 0): Script</a></li>
465469
</ul></dd>
466470
<dt><a name="newServer" href="#newServer"><span>newServer:</span></a></dt><dd><ul class="simple">
467471
<li><a class="reference external"
@@ -677,6 +681,10 @@ <h1 class="title">Index</h1>
677681
<li><a class="reference external"
678682
data-doc-search-tag="bindings: showCpy(win: ptr Window; html: cstring; browser: cuint): bool" href="webui/bindings.html#showCpy%2Cptr.Window%2Ccstring%2Ccuint">bindings: showCpy(win: ptr Window; html: cstring; browser: cuint): bool</a></li>
679683
</ul></dd>
684+
<dt><a name="showed" href="#showed"><span>showed:</span></a></dt><dd><ul class="simple">
685+
<li><a class="reference external"
686+
data-doc-search-tag="webui: showed(win: Window): bool" href="webui.html#showed%2CWindow">webui: showed(win: Window): bool</a></li>
687+
</ul></dd>
680688
<dt><a name="shown" href="#shown"><span>shown:</span></a></dt><dd><ul class="simple">
681689
<li><a class="reference external"
682690
data-doc-search-tag="webui: shown(win: Window): bool" href="webui.html#shown%2CWindow">webui: shown(win: Window): bool</a></li>
@@ -840,7 +848,7 @@ <h1 class="title">Index</h1>
840848
<div class="twelve-columns footer">
841849
<span class="nim-sprite"></span>
842850
<br/>
843-
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 01:57:32 UTC</small>
851+
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 11:28:45 UTC</small>
844852
</div>
845853
</div>
846854
</div>

docs/webui.html

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ <h1 class="title">webui</h1>
320320
<li><a class="reference" href="#elementName%2CEvent"
321321
title="elementName(e: Event): string">elementName(e: Event): string</a></li>
322322

323+
</ul>
324+
<ul class="simple nested-toc-section">evalJs
325+
<li><a class="reference" href="#evalJs%2CWindow%2Cstring%2Cint"
326+
title="evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult">evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult</a></li>
327+
323328
</ul>
324329
<ul class="simple nested-toc-section">event
325330
<li><a class="reference" href="#event%2CWindow%2Cstring%2Cstring%2Cpointer%2Cint"
@@ -452,7 +457,7 @@ <h1 class="title">webui</h1>
452457
</ul>
453458
<ul class="simple nested-toc-section">newScript
454459
<li><a class="reference" href="#newScript%2Cstring%2Cint"
455-
title="newScript(script: string; timeout: int): Script">newScript(script: string; timeout: int): Script</a></li>
460+
title="newScript(script: string; timeout: int = 0): Script">newScript(script: string; timeout: int = 0): Script</a></li>
456461

457462
</ul>
458463
<ul class="simple nested-toc-section">newServer
@@ -606,6 +611,11 @@ <h1 class="title">webui</h1>
606611
<li><a class="reference" href="#showCopy%2CWindow%2C%2CBrowser"
607612
title="showCopy(win: Window; html: string | Uri; browser: Browser = BrowserAny): bool">showCopy(win: Window; html: string | Uri; browser: Browser = BrowserAny): bool</a></li>
608613

614+
</ul>
615+
<ul class="simple nested-toc-section">showed
616+
<li><a class="reference" href="#showed%2CWindow"
617+
title="showed(win: Window): bool">showed(win: Window): bool</a></li>
618+
609619
</ul>
610620
<ul class="simple nested-toc-section">shown
611621
<li><a class="reference" href="#shown%2CWindow"
@@ -813,12 +823,12 @@ <h2><a class="toc-backref" id="application-startup-timeout" href="#application-s
813823
</pre></p>
814824

815825
<h2><a class="toc-backref" id="application-multi-access" href="#application-multi-access">Multi Access</a></h2><p><a class="reference external" href="For some reason using markdown doesn't work for images..."></a></p>
816-
<img src="https://webui.me/docs/data/webui_access_denied.png" alt="WebUI access denied image"/><p>After the window is loaded, for safety, the used URL is not valid anymore, if someone else tries to access the URL WebUI will show an error. To allow multi-user access to the same URL, you can use <tt class="docutils literal"><span class="pre"><span class="Identifier">multiAccess</span><span class="Operator">=</span></span></tt>.</p>
826+
<img src="https://webui.me/docs/data/webui_access_denied.png" alt="WebUI access denied image"/><p>After the window is loaded, for safety, the used URL is not valid anymore, if someone else tries to access the URL, WebUI will show an error. To allow multi-user access to the same URL, you can use <tt class="docutils literal"><span class="pre"><span class="Identifier">multiAccess</span><span class="Operator">=</span></span></tt>.</p>
817827
<p><pre class="listing"><span class="Identifier">window</span><span class="Operator">.</span><span class="Identifier">multiAccess</span> <span class="Operator">=</span> <span class="Identifier">true</span>
818828
</pre></p>
819829

820830
<h1><a class="toc-backref" id="event" href="#event">Event</a></h1>
821-
<h2><a class="toc-backref" id="event-event" href="#event-event">Event</a></h2><p>When you use <tt class="docutils literal"><span class="pre"><span class="Identifier">window</span><span class="Operator">.</span><span class="Keyword">bind</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt>, your application will receive an event every time the user clicks on the specified HTML element. The event comes with the <tt class="docutils literal"><span class="pre"><span class="Identifier">elementName</span></span></tt>, which is The HTML ID of the clicked element, for example, <tt class="docutils literal"><span class="pre"><span class="Identifier">MyButton</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">MyInput</span></span></tt>, etc., The event also comes with the WebUI unique element ID &amp; the unique window ID. Those two IDs are not generally needed.</p>
831+
<h2><a class="toc-backref" id="event-event" href="#event-event">Event</a></h2><p>When you use <tt class="docutils literal"><span class="pre"><span class="Identifier">window</span><span class="Operator">.</span><span class="Keyword">bind</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt>, your application will receive an event every time the user clicks on the specified HTML element. The event comes with the <tt class="docutils literal"><span class="pre"><span class="Identifier">elementName</span></span></tt>, which is the HTML ID of the clicked element, for example, <tt class="docutils literal"><span class="pre"><span class="Identifier">MyButton</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">MyInput</span></span></tt>, etc. The event also comes with the WebUI unique element ID &amp; the unique window ID. Those two IDs are not generally needed.</p>
822832
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">myProc</span><span class="Punctuation">(</span><span class="Identifier">e</span><span class="Punctuation">:</span> <span class="Identifier">Event</span><span class="Punctuation">)</span> <span class="Operator">=</span>
823833
<span class="Identifier">echo</span> <span class="StringLit">&quot;Hi!, You clicked on &quot;</span><span class="Punctuation">,</span> <span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">elementName</span><span class="Punctuation">,</span> <span class="StringLit">&quot; element&quot;</span>
824834
</pre></p>
@@ -836,7 +846,11 @@ <h2><a class="toc-backref" id="run-javascript-script" href="#run-javascript-scri
836846
<span class="Comment"># window.script requires a `var` type</span>
837847
<span class="Keyword">var</span> <span class="Identifier">js</span> <span class="Operator">=</span> <span class="Identifier">newScript</span><span class="Punctuation">(</span><span class="StringLit">&quot;alert('Hello');&quot;</span><span class="Punctuation">)</span>
838848

839-
<span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">window</span><span class="Operator">.</span><span class="Identifier">script</span><span class="Punctuation">(</span><span class="Identifier">js</span><span class="Punctuation">)</span>
849+
<span class="Keyword">let</span> <span class="Identifier">jsResult</span> <span class="Operator">=</span> <span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">window</span><span class="Operator">.</span><span class="Identifier">script</span><span class="Punctuation">(</span><span class="Identifier">js</span><span class="Punctuation">)</span>
850+
</pre></p>
851+
<p>or</p>
852+
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">myProc</span><span class="Punctuation">(</span><span class="Identifier">e</span><span class="Punctuation">:</span> <span class="Identifier">Event</span><span class="Punctuation">)</span> <span class="Operator">=</span>
853+
<span class="Keyword">let</span> <span class="Identifier">jsResult</span> <span class="Operator">=</span> <span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">window</span><span class="Operator">.</span><span class="Identifier">evalJs</span><span class="Punctuation">(</span><span class="StringLit">&quot;alert('Hello');&quot;</span><span class="Punctuation">)</span>
840854
</pre></p>
841855
<p>An example of how to run a JavaScript and get back the output as string, and check for errors, if any.</p>
842856
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">myProc</span><span class="Punctuation">(</span><span class="Identifier">e</span><span class="Punctuation">:</span> <span class="Identifier">Event</span><span class="Punctuation">)</span> <span class="Operator">=</span>
@@ -990,7 +1004,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
9901004
<span class="Identifier">discardable</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
9911005
<dd>
9921006

993-
Bind <tt class="docutils literal"><span class="pre"><span class="Keyword">func</span></span></tt> to element <tt class="docutils literal"><span class="pre"><span class="Identifier">element</span></span></tt> and automatically pass return value of <tt class="docutils literal"><span class="pre"><span class="Keyword">func</span></span></tt> to Javascript Bind <tt class="docutils literal"><span class="pre"><span class="Keyword">func</span></span></tt> to element <tt class="docutils literal"><span class="pre"><span class="Identifier">element</span></span></tt> and automatically pass return value of <tt class="docutils literal"><span class="pre"><span class="Keyword">func</span></span></tt> to Javascript
1007+
Bind <tt class="docutils literal"><span class="pre"><span class="Keyword">func</span></span></tt> to element <tt class="docutils literal"><span class="pre"><span class="Identifier">element</span></span></tt> and automatically pass return value of <tt class="docutils literal"><span class="pre"><span class="Keyword">func</span></span></tt> to Javascript
9941008

9951009
</dd>
9961010
</div>
@@ -1273,6 +1287,15 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
12731287

12741288

12751289

1290+
</dd>
1291+
</div>
1292+
<div id="evalJs,Window,string,int">
1293+
<dt><pre><span class="Keyword">proc</span> <a href="#evalJs%2CWindow%2Cstring%2Cint"><span class="Identifier">evalJs</span></a><span class="Other">(</span><span class="Identifier">win</span><span class="Other">:</span> <a href="webui.html#Window"><span class="Identifier">Window</span></a><span class="Other">;</span> <span class="Identifier">script</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">timeout</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="webui.html#JavascriptResult"><span class="Identifier">JavascriptResult</span></a> {.
1294+
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
1295+
<dd>
1296+
1297+
Evaluate Javascript code <tt class="docutils literal"><span class="pre"><span class="Identifier">script</span></span></tt> and return the result
1298+
12761299
</dd>
12771300
</div>
12781301
<div id="event,Window,string,string,pointer,int">
@@ -1525,7 +1548,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
15251548
</dd>
15261549
</div>
15271550
<div id="newScript,string,int">
1528-
<dt><pre><span class="Keyword">proc</span> <a href="#newScript%2Cstring%2Cint"><span class="Identifier">newScript</span></a><span class="Other">(</span><span class="Identifier">script</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">timeout</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="webui.html#Script"><span class="Identifier">Script</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
1551+
<dt><pre><span class="Keyword">proc</span> <a href="#newScript%2Cstring%2Cint"><span class="Identifier">newScript</span></a><span class="Other">(</span><span class="Identifier">script</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">timeout</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="webui.html#Script"><span class="Identifier">Script</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
15291552
<dd>
15301553

15311554
Create a new Script object
@@ -1793,6 +1816,14 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
17931816

17941817

17951818

1819+
</dd>
1820+
</div>
1821+
<div id="showed,Window">
1822+
<dt><pre><span class="Keyword">proc</span> <a href="#showed%2CWindow"><span class="Identifier">showed</span></a><span class="Other">(</span><span class="Identifier">win</span><span class="Other">:</span> <a href="webui.html#Window"><span class="Identifier">Window</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
1823+
<dd>
1824+
1825+
Synonym of <a class="reference external" href="#shown,Window">shown</a>
1826+
17961827
</dd>
17971828
</div>
17981829
<div id="shown,Window">
@@ -1898,7 +1929,7 @@ <h1><a class="toc-backref" href="#19">Exports</a></h1>
18981929
<div class="twelve-columns footer">
18991930
<span class="nim-sprite"></span>
19001931
<br/>
1901-
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 01:57:32 UTC</small>
1932+
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 11:28:45 UTC</small>
19021933
</div>
19031934
</div>
19041935
</div>

docs/webui.idx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ autoLink webui.html#autoLink,CustomBrowser webui: autoLink(c: CustomBrowser): bo
4747
app= webui.html#app=,CustomBrowser,string webui: app=(c: CustomBrowser; app: string)
4848
arg= webui.html#arg=,CustomBrowser,string webui: arg=(c: CustomBrowser; arg: string)
4949
autoLink= webui.html#autoLink=,CustomBrowser,bool webui: autoLink=(c: CustomBrowser; autoLink: bool)
50-
newScript webui.html#newScript,string,int webui: newScript(script: string; timeout: int): Script
50+
newScript webui.html#newScript,string,int webui: newScript(script: string; timeout: int = 0): Script
5151
script webui.html#script,Script webui: script(s: Script): string
5252
timeout webui.html#timeout,Script webui: timeout(s: Script): int
5353
script= webui.html#script=,Script,string webui: script=(s: Script; script: string)
@@ -98,7 +98,9 @@ multiAccess= webui.html#multiAccess=,Window,bool webui: multiAccess=(win: Window
9898
newServer webui.html#newServer,Window,string webui: newServer(win: Window; path: string): string
9999
close webui.html#close,Window webui: close(win: Window)
100100
shown webui.html#shown,Window webui: shown(win: Window): bool
101+
showed webui.html#showed,Window webui: showed(win: Window): bool
101102
script webui.html#script,Window,Script webui: script(win: Window; script: var Script)
103+
evalJs webui.html#evalJs,Window,string,int webui: evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult
102104
`bind` webui.html#bind,Window,string,proc(Event) webui: `bind`(win: Window; element: string; func: proc (e: Event)): int
103105
`bind` webui.html#bind,Window,string,proc(Event)_2 webui: `bind`(win: Window; element: string; func: proc (e: Event): string): int
104106
`bind` webui.html#bind,Window,string,proc(Event)_3 webui: `bind`(win: Window; element: string; func: proc (e: Event): int): int

docs/webui/bindings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
15771577
<div class="twelve-columns footer">
15781578
<span class="nim-sprite"></span>
15791579
<br/>
1580-
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 01:57:32 UTC</small>
1580+
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 11:28:45 UTC</small>
15811581
</div>
15821582
</div>
15831583
</div>

0 commit comments

Comments
 (0)