| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- {{define "guide"}}<article class="doc">
- <p class="crumb">{{.Guide.Guide.Group}}</p>
- <h1 class="doc-title">{{.Title}}</h1>
- {{with .Desc}}<p class="doc-lead">{{.}}</p>{{end}}
- <div class="prose">
- {{.Guide.Intro}}
- {{range .Guide.Items}}{{heading .Heading.Level .Heading.ID .Heading.Aliases .Heading.HTML}}
- {{.Body}}
- {{end}}
- </div>
- </article>{{end}}
- {{define "ref"}}<article class="doc">
- <p class="crumb">{{if .Ref.Builtin}}Built-in functions{{else}}Library{{end}}</p>
- <h1 class="doc-title">{{if .Ref.Builtin}}{{.Title}}{{else}}<code>{{.Title}}</code>{{end}}</h1>
- {{with .Desc}}<p class="doc-lead">{{.}}</p>{{end}}
- <div class="meta-row">
- {{if .Ref.Page.Load}}<span class="load"><code>{{.Ref.Page.Load}}</code><button type="button" class="copy-mini" data-copy="{{.Ref.Page.Load}}" aria-label="Copy">{{icon "copy"}}</button></span>{{else}}<span class="pill">Always available, no <code>requirelib()</code></span>{{end}}
- {{if .Ref.Index}}<span class="pill">{{len .Ref.Index}} functions</span>{{end}}
- <a class="pill pill-pg" href="../playground.html" title="{{if eq .Ref.Play "runs"}}The playground runs this against its virtual drive and session{{else}}The playground answers with the responses you set in its {{.Ref.Play}} window{{end}}">{{icon "play"}}{{if eq .Ref.Play "runs"}}Runs in the playground{{else}}Mocked in the playground ({{.Ref.Play}} window){{end}}</a>
- </div>
- <div class="prose">{{.Ref.Intro}}</div>
- {{if .Ref.Index}}<details class="fn-index"{{if le (len .Ref.Index) 24}} open{{end}}>
- <summary>Functions <span>{{len .Ref.Index}}</span></summary>
- <table>
- <tbody>{{range .Ref.Index}}<tr><td><a href="#{{.Anchor}}"><code>{{.Name}}</code></a></td><td class="ix-ret">{{with .Ret}}<code>{{.}}</code>{{end}}</td><td class="ix-desc">{{.Desc}}</td></tr>{{end}}</tbody>
- </table>
- </details>{{end}}
- <div class="prose ref-body">
- {{range .Ref.Items}}{{if .Fn}}{{template "fn" .Fn}}{{else}}{{heading .Heading.Level .Heading.ID .Heading.Aliases .Heading.HTML}}
- {{.Body}}{{end}}
- {{end}}
- </div>
- </article>{{end}}
- {{define "fn"}}<section class="fn" id="{{.ID}}">
- {{range .Aliases}}<span id="{{.}}" class="alias"></span>{{end}}
- <div class="fn-head">
- {{range $i, $s := .Sigs}}<div class="fn-sig"{{if eq $i 0}} role="heading" aria-level="{{$.Level}}"{{end}}>
- <code class="sig"><span class="sig-name">{{.Name}}</span>{{with .Args}}<span class="sig-args">{{.}}</span>{{end}}</code>
- {{with .Ret}}<span class="ret" title="Returns">{{.}}</span>{{end}}
- {{if eq $i 0}}{{range $.Badges}}<span class="badge">{{.}}</span>{{end}}<a class="hd-link" href="#{{$.ID}}" aria-label="Link to {{.Name}}">#</a>{{end}}
- </div>
- {{with .Also}}<p class="also">Also covers {{range $j, $n := .}}{{if $j}}, {{end}}<code>{{$n}}</code>{{end}}</p>{{end}}
- {{with .Desc}}<p class="fn-desc">{{.}}</p>{{end}}{{end}}
- </div>
- {{if .Body}}<div class="fn-body">{{.Body}}</div>{{end}}
- {{range .Examples}}<pre class="example"><code class="language-javascript">{{.}}</code></pre>{{end}}
- </section>{{end}}
- {{define "home"}}<section class="hero">
- <div class="hero-glow" aria-hidden="true"></div>
- <div class="hero-in">
- <p class="eyebrow">ArozOS Developers</p>
- <h1 class="hero-title">Build WebApps with <span class="grad">AGI</span>.</h1>
- <p class="hero-lead">AGI is the server-side JavaScript runtime of ArozOS. Your WebApp's scripts read and write the user's files, keep data, talk to other services and answer the page, all inside the user's permissions.</p>
- <div class="btns">
- <a class="btn primary" href="introduction.html">Get started</a>
- <a class="btn secondary" href="playground.html">{{icon "play"}}<span>Open the playground</span></a>
- </div>
- <button type="button" class="hero-search" data-search-open>{{icon "search"}}<span>Search {{.Home.FnCount}} functions</span><kbd data-kbd>Ctrl K</kbd></button>
- </div>
- </section>
- <section class="band">
- <div class="wrap">
- <div class="quick">
- <a class="qcard" href="introduction.html">
- <span class="qicon">{{icon "book"}}</span>
- <h2>Guides</h2>
- <p>What AGI is, where scripts run, the globals they see and how paths and permissions work.</p>
- <span class="qmore">Read the introduction {{icon "arrow-right"}}</span>
- </a>
- <a class="qcard" href="reference/core.html">
- <span class="qicon">{{icon "code"}}</span>
- <h2>API reference</h2>
- <p>Every function of every library, with its signature, return value and an example you can run.</p>
- <span class="qmore">Browse the reference {{icon "arrow-right"}}</span>
- </a>
- <a class="qcard" href="playground.html">
- <span class="qicon">{{icon "play"}}</span>
- <h2>Playground</h2>
- <p>The real Otto interpreter in your browser, a virtual file system to upload to, and mock services for HTTP, LLM and CNN.</p>
- <span class="qmore">Try {{.Home.Samples}} samples {{icon "arrow-right"}}</span>
- </a>
- </div>
- </div>
- </section>
- <section class="band">
- <div class="wrap">
- <div class="split">
- <div>
- <h2 class="band-title">A first script</h2>
- <p class="band-lead">A WebApp's page calls its backend script with <code>ao_module_agirun()</code>. The script runs as the signed-in user and answers with <code>sendResp</code> or <code>sendJSONResp</code>.</p>
- <ul class="start">{{range .Home.Start}}<li><a href="{{.URL}}"><strong>{{.Title}}</strong><span>{{.Sub}}</span></a></li>{{end}}</ul>
- </div>
- <pre class="example hero-code"><code class="language-javascript">// MyApp/backend.agi
- requirelib("filelib");
- var notes = filelib.readdir("user:/Documents");
- var names = [];
- for (var i = 0; i < notes.length; i++) {
- if (!notes[i].IsDir) names.push(notes[i].Filename);
- }
- sendJSONResp({ user: USERNAME, files: names });</code></pre>
- </div>
- </div>
- </section>
- <section class="band">
- <div class="wrap">
- <h2 class="band-title">Built-in functions</h2>
- <p class="band-lead">Always there, without <code>requirelib()</code>.</p>
- <div class="libs">{{range .Home.Builtins}}{{template "libcard" .}}{{end}}</div>
- <h2 class="band-title">Libraries</h2>
- <p class="band-lead">Load one with <code>requirelib("name")</code> before using it.</p>
- <div class="libs">{{range .Home.Libraries}}{{template "libcard" .}}{{end}}</div>
- </div>
- </section>{{end}}
- {{define "libcard"}}<a class="lib" href="{{.URL}}">
- <span class="lib-ic">{{icon .Icon}}</span>
- <span class="lib-txt"><strong>{{.Title}}</strong><span>{{.Desc}}</span></span>
- <span class="lib-n">{{.Count}}</span>
- </a>{{end}}
|