Skip to content

Commit

Permalink
update docs onee last time
Browse files Browse the repository at this point in the history
  • Loading branch information
neroist committed Mar 13, 2023
1 parent cccba37 commit d29bc2f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 20 deletions.
12 changes: 10 additions & 2 deletions docs/theindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ <h1 class="title">Index</h1>
<li><a class="reference external"
data-doc-search-tag="webui: elementName(e: Event): string" href="webui.html#elementName%2CEvent">webui: elementName(e: Event): string</a></li>
</ul></dd>
<dt><a name="evalJs" href="#evalJs"><span>evalJs:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
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>
</ul></dd>
<dt><a name="Event" href="#Event"><span>Event:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="webui: Event" href="webui.html#Event">webui: Event</a></li>
Expand Down Expand Up @@ -461,7 +465,7 @@ <h1 class="title">Index</h1>
</ul></dd>
<dt><a name="newScript" href="#newScript"><span>newScript:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
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>
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>
</ul></dd>
<dt><a name="newServer" href="#newServer"><span>newServer:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
Expand Down Expand Up @@ -677,6 +681,10 @@ <h1 class="title">Index</h1>
<li><a class="reference external"
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>
</ul></dd>
<dt><a name="showed" href="#showed"><span>showed:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="webui: showed(win: Window): bool" href="webui.html#showed%2CWindow">webui: showed(win: Window): bool</a></li>
</ul></dd>
<dt><a name="shown" href="#shown"><span>shown:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="webui: shown(win: Window): bool" href="webui.html#shown%2CWindow">webui: shown(win: Window): bool</a></li>
Expand Down Expand Up @@ -840,7 +848,7 @@ <h1 class="title">Index</h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 01:57:32 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 11:28:45 UTC</small>
</div>
</div>
</div>
Expand Down
45 changes: 38 additions & 7 deletions docs/webui.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ <h1 class="title">webui</h1>
<li><a class="reference" href="#elementName%2CEvent"
title="elementName(e: Event): string">elementName(e: Event): string</a></li>

</ul>
<ul class="simple nested-toc-section">evalJs
<li><a class="reference" href="#evalJs%2CWindow%2Cstring%2Cint"
title="evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult">evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult</a></li>

</ul>
<ul class="simple nested-toc-section">event
<li><a class="reference" href="#event%2CWindow%2Cstring%2Cstring%2Cpointer%2Cint"
Expand Down Expand Up @@ -452,7 +457,7 @@ <h1 class="title">webui</h1>
</ul>
<ul class="simple nested-toc-section">newScript
<li><a class="reference" href="#newScript%2Cstring%2Cint"
title="newScript(script: string; timeout: int): Script">newScript(script: string; timeout: int): Script</a></li>
title="newScript(script: string; timeout: int = 0): Script">newScript(script: string; timeout: int = 0): Script</a></li>

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

</ul>
<ul class="simple nested-toc-section">showed
<li><a class="reference" href="#showed%2CWindow"
title="showed(win: Window): bool">showed(win: Window): bool</a></li>

</ul>
<ul class="simple nested-toc-section">shown
<li><a class="reference" href="#shown%2CWindow"
Expand Down Expand Up @@ -813,12 +823,12 @@ <h2><a class="toc-backref" id="application-startup-timeout" href="#application-s
</pre></p>

<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>
<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>
<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>
<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>
</pre></p>

<h1><a class="toc-backref" id="event" href="#event">Event</a></h1>
<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>
<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>
<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>
<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>
</pre></p>
Expand All @@ -836,7 +846,11 @@ <h2><a class="toc-backref" id="run-javascript-script" href="#run-javascript-scri
<span class="Comment"># window.script requires a `var` type</span>
<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>

<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>
<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>
</pre></p>
<p>or</p>
<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>
<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>
</pre></p>
<p>An example of how to run a JavaScript and get back the output as string, and check for errors, if any.</p>
<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>
Expand Down Expand Up @@ -990,7 +1004,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<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>
<dd>

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
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

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



</dd>
</div>
<div id="evalJs,Window,string,int">
<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> {.
<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>
<dd>

Evaluate Javascript code <tt class="docutils literal"><span class="pre"><span class="Identifier">script</span></span></tt> and return the result

</dd>
</div>
<div id="event,Window,string,string,pointer,int">
Expand Down Expand Up @@ -1525,7 +1548,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
</dd>
</div>
<div id="newScript,string,int">
<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>
<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>
<dd>

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



</dd>
</div>
<div id="showed,Window">
<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>
<dd>

Synonym of <a class="reference external" href="#shown,Window">shown</a>

</dd>
</div>
<div id="shown,Window">
Expand Down Expand Up @@ -1898,7 +1929,7 @@ <h1><a class="toc-backref" href="#19">Exports</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 01:57:32 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 11:28:45 UTC</small>
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion docs/webui.idx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ autoLink webui.html#autoLink,CustomBrowser webui: autoLink(c: CustomBrowser): bo
app= webui.html#app=,CustomBrowser,string webui: app=(c: CustomBrowser; app: string)
arg= webui.html#arg=,CustomBrowser,string webui: arg=(c: CustomBrowser; arg: string)
autoLink= webui.html#autoLink=,CustomBrowser,bool webui: autoLink=(c: CustomBrowser; autoLink: bool)
newScript webui.html#newScript,string,int webui: newScript(script: string; timeout: int): Script
newScript webui.html#newScript,string,int webui: newScript(script: string; timeout: int = 0): Script
script webui.html#script,Script webui: script(s: Script): string
timeout webui.html#timeout,Script webui: timeout(s: Script): int
script= webui.html#script=,Script,string webui: script=(s: Script; script: string)
Expand Down Expand Up @@ -98,7 +98,9 @@ multiAccess= webui.html#multiAccess=,Window,bool webui: multiAccess=(win: Window
newServer webui.html#newServer,Window,string webui: newServer(win: Window; path: string): string
close webui.html#close,Window webui: close(win: Window)
shown webui.html#shown,Window webui: shown(win: Window): bool
showed webui.html#showed,Window webui: showed(win: Window): bool
script webui.html#script,Window,Script webui: script(win: Window; script: var Script)
evalJs webui.html#evalJs,Window,string,int webui: evalJs(win: Window; script: string; timeout: int = 0): JavascriptResult
`bind` webui.html#bind,Window,string,proc(Event) webui: `bind`(win: Window; element: string; func: proc (e: Event)): int
`bind` webui.html#bind,Window,string,proc(Event)_2 webui: `bind`(win: Window; element: string; func: proc (e: Event): string): int
`bind` webui.html#bind,Window,string,proc(Event)_3 webui: `bind`(win: Window; element: string; func: proc (e: Event): int): int
Expand Down
2 changes: 1 addition & 1 deletion docs/webui/bindings.html
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 01:57:32 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-03-13 11:28:45 UTC</small>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit d29bc2f

Please sign in to comment.