2 lines
5.9 KiB
JavaScript
2 lines
5.9 KiB
JavaScript
import{_ as r,a as t,b as a,ag as o}from"./chunks/framework.BcrMLAmg.js";const u=JSON.parse('{"title":"Program","description":"","frontmatter":{},"headers":[],"relativePath":"references/elements/Program.md","filePath":"references/elements/Program.md","lastUpdated":1757844696000}'),n={name:"references/elements/Program.md"};function d(i,e,s,l,h,c){return a(),t("div",null,e[0]||(e[0]=[o('<h1 id="program" tabindex="-1">Program <a class="header-anchor" href="#program" aria-label="Permalink to "Program""></a></h1><p><em>This is the program class. It provides a program that runs in a window.</em></p><p>Extends: <code>VisualElement</code></p><h2 id="properties" tabindex="-1">Properties <a class="header-anchor" href="#properties" aria-label="Permalink to "Properties""></a></h2><table tabindex="0"><thead><tr><th>Property</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>program</td><td>table</td><td>nil</td><td>The program instance</td></tr><tr><td>path</td><td>string</td><td>""</td><td>The path to the program</td></tr><tr><td>running</td><td>boolean</td><td>false</td><td>Whether the program is running</td></tr><tr><td>errorCallback</td><td>function</td><td>nil</td><td>The error callback function</td></tr><tr><td>doneCallback</td><td>function</td><td>nil</td><td>The done callback function</td></tr></tbody></table><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to "Functions""></a></h2><table tabindex="0"><thead><tr><th>Method</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><a href="#program-execute-path-env-addenvironment">Program:execute</a></td><td>Program</td><td>Executes a program</td></tr><tr><td><a href="#program-stop">Program:stop</a></td><td>Program</td><td>Stops the program</td></tr><tr><td><a href="#program-sendevent-event-any">Program:sendEvent</a></td><td>Program</td><td>Sends an event to the program</td></tr><tr><td><a href="#program-onerror-fn">Program:onError</a></td><td>Program</td><td>Registers a callback for the program's error event</td></tr><tr><td><a href="#program-ondone-fn">Program:onDone</a></td><td>Program</td><td>Registers a callback for the program's done event</td></tr></tbody></table><h2 id="program-execute-path-env-addenvironment" tabindex="-1">Program:execute(path, env?, addEnvironment?) <a class="header-anchor" href="#program-execute-path-env-addenvironment" aria-label="Permalink to "Program:execute(path, env?, addEnvironment?)""></a></h2><p>Executes a program</p><h3 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>path</code> <code>string</code> The path to the program</li><li><code>env</code> <em>(optional)</em> <code>table</code> The environment to run the program in</li><li><code>addEnvironment</code> <em>(optional)</em> <code>boolean</code> Whether to add the environment to the program's environment (false = overwrite instead of adding)</li></ul><h3 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Program</code> <code>self</code> The Program instance</li></ul><h2 id="program-stop" tabindex="-1">Program:stop() <a class="header-anchor" href="#program-stop" aria-label="Permalink to "Program:stop()""></a></h2><p>Stops the program</p><h3 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Program</code> <code>self</code> The Program instance</li></ul><h2 id="program-sendevent-event-any" tabindex="-1">Program:sendEvent(event, any) <a class="header-anchor" href="#program-sendevent-event-any" aria-label="Permalink to "Program:sendEvent(event, any)""></a></h2><p>Sends an event to the program</p><h3 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>event</code> <code>string</code> The event to send</li><li><code>any</code> <code>The</code> event arguments</li></ul><h3 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Program</code> <code>self</code> The Program instance</li></ul><h2 id="program-onerror-fn" tabindex="-1">Program:onError(fn) <a class="header-anchor" href="#program-onerror-fn" aria-label="Permalink to "Program:onError(fn)""></a></h2><p>Registers a callback for the program's error event, if the function returns false, the program won't stop</p><h3 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>fn</code> <code>function</code> The callback function to register</li></ul><h3 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Program</code> <code>self</code> The Program instance</li></ul><h2 id="program-ondone-fn" tabindex="-1">Program:onDone(fn) <a class="header-anchor" href="#program-ondone-fn" aria-label="Permalink to "Program:onDone(fn)""></a></h2><p>Registers a callback for the program's done event</p><h3 id="parameters-3" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-3" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>fn</code> <code>function</code> The callback function to register</li></ul><h3 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Program</code> <code>self</code> The Program instance</li></ul>',35)]))}const p=r(n,[["render",d]]);export{u as __pageData,p as default};
|