seed: Index | Files | Directories

package script

import ""


Package Files

animation.go app.go array.go connection.go dynamic.go feed.go functions.go geolocation.go go.go html.go js.go object.go pages.go popups.go promise.go requests.go rpc.go script.go seed.go strings.go style.go time.go types.go update.go website.go window.go


const Back = "" /* 631 byte string literal not displayed */

Back is the JS code needed for back functionality.

const DataRequestJS = "" /* 613 byte string literal not displayed */

DataRequestJS is the js defined data_request function.

const Format = "" /* 210 byte string literal not displayed */

Format is required to format text.

const GeoLocation = "" /* 274 byte string literal not displayed */

GeoLocation is the JS required for GeoLocation support.

const Get = "" /* 480 byte string literal not displayed */

Get is the required JS code for getting seeds.

const Goto = "" /* 3311 byte string literal not displayed */+

Goto is the JS code for goto (page switching) support.

const InstallJS = "" /* 1802 byte string literal not displayed */

InstallJS installs the app to the user's device.

const Open = "" /* 449 byte string literal not displayed */

Open is the JS required for q.Open(..).

const Request = "" /* 1058 byte string literal not displayed */

Request is the JS code required to make Go calls.

const Set = `
function set(element, property, value) {[property] = value;

Set is the required JS code for setting styles.

const SetClipboard = "" /* 541 byte string literal not displayed */

SetClipboard is the JS code requried for Clipboard support.

const Update = "" /* 811 byte string literal not displayed */

Update is Javascript code for updating.


var Exports = make(map[string]reflect.Value)

func ConnectionHandler Uses

func ConnectionHandler(w http.ResponseWriter, r *http.Request, call string)

ConnectionHandler handles connection connections. TODO rename.

func Handler Uses

func Handler(w http.ResponseWriter, r *http.Request, call string)

Handler returns a handler for handling remote procedure calls.

func ToJavascript Uses

func ToJavascript(f func(q Ctx), ctx ...internal.Context) []byte

ToJavascript returns the given script encoded as Javascript.

func Unique Uses

func Unique() string

Unique returns a unique string suitable for variable names.

type Animation Uses

type Animation = internal.Animation

Animation is a mapping of float64 to frames as a ratio between 0 and 1 (start and end).

type Any Uses

type Any = Dynamic

type AnyCtx Uses

type AnyCtx = qlova.AnyCtx

type AnyString Uses

type AnyString = qlova.AnyString

type Args Uses

type Args map[string]qlova.Type

Args is a mapping from strings to script types.

type Array Uses

type Array struct {
    Q   Ctx

Array is a dynamic-content array.

func (Array) Index Uses

func (a Array) Index(i Int) Dynamic

Index returns the value at the given index in the array.

func (Array) Mutate Uses

func (a Array) Mutate(i Int, v qlova.Type)

Mutate sets the value at the given index in the array.

func (Array) Push Uses

func (a Array) Push(v qlova.Type)

Push pushes a new value to the array.

func (Array) Var Uses

func (a Array) Var(name ...string) Array

Var calls Native.Var(...string).

type Attachable Uses

type Attachable interface {
    AttachTo(request string, index int) string

Attachable is a something that can be attached to a Go call.

type Attached Uses

type Attached struct {
    // contains filtered or unexported fields

Attached has attachments and these will be passed to the Go function that is called.

func (Attached) Go Uses

func (c Attached) Go(f interface{}, args ...qlova.AnyValue) Promise

Go calls a Go function f, with args. Returns a promise.

func (Attached) With Uses

func (c Attached) With(args Args) Attached

With adds arguments to the attached call.

type Bool Uses

type Bool = qlovascript.Bool

Bool is the script bool type.

type Color Uses

type Color struct {

Color is a script interface to a color value.

type Connection Uses

type Connection struct {
    Q   Ctx

Connection is a script interface to a channel.

type Ctx Uses

type Ctx struct {
    // contains filtered or unexported fields

Ctx is a script context. Providing access to script behaviours.

func CtxFromAnyCtx Uses

func CtxFromAnyCtx(any AnyCtx) Ctx

func (Ctx) After Uses

func (q Ctx) After(time float64, f func())

After executes a function after the given number of milliseconds have passed.

func (Ctx) Alert Uses

func (q Ctx) Alert(message qlova.String)

Alert displays a message to the user.

func (Ctx) Attach Uses

func (q Ctx) Attach(attachables ...Attachable) Attached

Attach attaches Attachables and returns an AttachCall.

func (Ctx) Back Uses

func (q Ctx) Back()

Back returns to the last page on the stack. Popping the current page.

func (Ctx) CheckForUpdates Uses

func (q Ctx) CheckForUpdates()

CheckForUpdates checks for an update.

func (Ctx) ClearHistory Uses

func (q Ctx) ClearHistory()

ClearHistory clears the page history, you should call this after transitioning from a sign-in page.

func (Ctx) Color Uses

func (q Ctx) Color(c color.Color) Color

Color returns a script color based on the color.Color.

func (Ctx) Confirm Uses

func (q Ctx) Confirm(message qlova.String) qlova.Bool

Confirm displays a confirmation box to the user, returns a bool indicating true for 'ok' false for 'cancel'.

func (Ctx) Contains Uses

func (q Ctx) Contains(text, match qlova.String) qlova.Bool

Contains returns true if text contains match.

func (Ctx) CurrentPage Uses

func (q Ctx) CurrentPage() Page

CurrentPage returns the current page.

func (Ctx) DataRequest Uses

func (q Ctx) DataRequest(url String) Promise

DataRequest makes a new request execting JSON data from the specified URL.

func (Ctx) DataResponse Uses

func (q Ctx) DataResponse(key string) String

DataResponse returns the resulting value from the specified key inside of the data result object.

func (Ctx) Error Uses

func (q Ctx) Error() qlova.String

Error can be used to access the Go return error as a string. Only works inside a Promise callback, otherwise behaviour is undefined.

func (Ctx) Every Uses

func (q Ctx) Every(time float64, f func())

Every executes a function every number of milliseconds.

func (Ctx) GeoLocation Uses

func (q Ctx) GeoLocation() Location

GeoLocation returns the current Location.

func (Ctx) Go Uses

func (q Ctx) Go(function interface{}, args ...qlova.AnyValue) Promise

Go calls a Go function with the provided arguments.

func (Ctx) HardReset Uses

func (q Ctx) HardReset()

HardReset restarts the app and clears all user data.

func (Ctx) Hex Uses

func (q Ctx) Hex(s string) Color

Hex returns a color based on the hex value.

func (Ctx) Install Uses

func (q Ctx) Install()

Install installs the app to the user's device.

func (Ctx) JS Uses

func (q Ctx) JS() js

JS return the JS interface of script.

func (Ctx) Javascript Uses

func (q Ctx) Javascript(js string, args ...interface{})

Javascript inserts raw js into the script.

func (Ctx) LastPage Uses

func (q Ctx) LastPage() Page

LastPage returns the last page.

func (Ctx) NewArray Uses

func (q Ctx) NewArray(elements ...qlova.Value) Array

NewArray creates a new Array.

func (Ctx) NewObject Uses

func (q Ctx) NewObject() Object

NewObject creates a new Object.

func (Ctx) NextPage Uses

func (q Ctx) NextPage() Page

NextPage returns the next page.

func (Ctx) Open Uses

func (q Ctx) Open(f func(u user.Ctx)) Connection

Open opens a script <-> Go connection for continuos cross-communication.

func (Ctx) Prompt Uses

func (q Ctx) Prompt(message qlova.String) qlova.String

Prompt displays a prompt that requests a string from the user. This string is returned.

func (Ctx) PushHistory Uses

func (q Ctx) PushHistory(page Page)

PushHistory pushes the page to history.

func (Ctx) Query Uses

func (q Ctx) Query(query string) Element

Query allows finding an element based on a query string.

func (Ctx) RequestGeoLocation Uses

func (q Ctx) RequestGeoLocation() Promise

RequestGeoLocation requests GeoLocation information. This must be called before q.GeoLocation is called.

func (Ctx) Require Uses

func (q Ctx) Require(dependency string)

Require inserts the provided dependency string in the head of the document.

func (Ctx) ResizeWindowTo Uses

func (q Ctx) ResizeWindowTo(w, h Int)

ResizeWindowTo resizes the current window if possible to the requested dimensions.

func (Ctx) Restart Uses

func (q Ctx) Restart()

Restart peforms a restart of the app.

func (Ctx) ReturnValue Uses

func (q Ctx) ReturnValue() qlova.String

ReturnValue can be used to access the Go return value as a string. Only works inside a Promise callback, otherwise behaviour is undefined.

func (Ctx) Run Uses

func (q Ctx) Run(f Function, args ...qlova.Type)

Run runs a Javascript function with the given arguments.

func (Ctx) Seed Uses

func (ctx Ctx) Seed(options ...string) Seed

Seed creates a new seed dynamically.

func (Ctx) SetAppColor Uses

func (q Ctx) SetAppColor(c Color)

SetAppColor sets the color of the app theme dynamically.

func (Ctx) SetClipboard Uses

func (q Ctx) SetClipboard(text String)

SetClipboard sets the clipboard to the provided string.

func (Ctx) Strings Uses

func (q Ctx) Strings(slice ...string) Array

Strings creates a new script.Array of strings.

func (Ctx) SubString Uses

func (q Ctx) SubString(s String, start, end Int) String

SubString returns a slice of s, from start to end.

func (Ctx) ToString Uses

func (q Ctx) ToString(i Int) String

ToString turns a number into a string.

func (Ctx) URL Uses

func (script Ctx) URL(location qlova.String) URL

URL returns a new URL based on the given String.

func (Ctx) Unit Uses

func (q Ctx) Unit(unit complex128) Unit

Unit returns a script.Unit from the given unit.

func (Ctx) Update Uses

func (q Ctx) Update()

Update seamlessly restarts and updates the app from the server.

func (Ctx) Value Uses

func (q Ctx) Value(format string, args ...interface{}) value

Value wraps a JS string as a value that can be cast to script.Type.

func (Ctx) Website Uses

func (script Ctx) Website(location qlova.String) URL

Website returns a new URL based on the given String.

func (Ctx) With Uses

func (q Ctx) With(args Args) Attached

With adds arguments to the attached call.

type Dynamic Uses

type Dynamic struct {
    Q   Ctx

Dynamic can be any script.Type

func (Dynamic) Array Uses

func (d Dynamic) Array() Array

Array returns the dynamic value as an array.

func (Dynamic) Object Uses

func (d Dynamic) Object() Object

Object returns the dynamic value as an object.

func (Dynamic) String Uses

func (d Dynamic) String() String

type Element Uses

type Element struct {
    // contains filtered or unexported fields

Element is an HTML element.

func (Element) Run Uses

func (element Element) Run(method string)

Run calls a method on an Element.

type Error Uses

type Error struct {
    Q   Ctx
    Code Int

Error is a Go call error.

func (Error) Connection Uses

func (e Error) Connection(f func())

Connection runs the `f` script if the error is a connection error.

func (Error) Go Uses

func (e Error) Go(f func())

Go runs the `f` script if the error is a Go error.

func (Error) NeedToLogin Uses

func (e Error) NeedToLogin(f func())

NeedToLogin runs 'f' if the user is Unauthorized.

type Feed Uses

type Feed struct {

Feed is a seed.Feed, containing feed data.

func (Feed) Data Uses

func (feed Feed) Data(key ...string) String

Data returns the data associated with this feed for the current template.

func (Feed) Refresh Uses

func (feed Feed) Refresh()

Refresh the feeds content from the server.

type File Uses

type File struct {
    Q   Ctx

File is a script interface to a file type.

func (File) Name Uses

func (f File) Name() String

Name returns the name of the file.

func (File) Type Uses

func (f File) Type() String

Type returns the type of the file.

func (File) URL Uses

func (f File) URL() Promise

URL returns a url to the file.

type Float Uses

type Float = qlovascript.Float

Float is the script float type.

type Function Uses

type Function string

Function is a script function.

type Int Uses

type Int = qlovascript.Int

Int is the script int type.

type Location Uses

type Location struct {
    Q   Ctx

Location is a type that contains geolocation data.

func (Location) Latitude Uses

func (loc Location) Latitude() Float

Latitude of the location.

func (Location) Longitude Uses

func (loc Location) Longitude() Float

Longitude of the location.

type Month Uses

type Month struct {
    Q   Ctx

A Month specifies a month of the year (January = 1, ...).

func (Month) String Uses

func (month Month) String() String

type Native Uses

type Native = qlovascript.Native

Native is a native type.

type Object Uses

type Object struct {
    Q   Ctx

Object is a dynamic-content object.

func (Object) Insert Uses

func (o Object) Insert(key String, value qlova.Value)

Insert sets the value of the object at the given key.

func (Object) Lookup Uses

func (o Object) Lookup(key String) Dynamic

Lookup gets the value of the object at the given key.

func (Object) Var Uses

func (o Object) Var(name ...string) Object

Var calls Native.Var(...string).

type Page Uses

type Page struct {

    //Hack to allow pages to be lazy added to apps.
    Page interface{}

Page is a script interface to seed.Page.

func (Page) Arg Uses

func (page Page) Arg(i Int) String

Arg returns the ith argument to this page.

func (Page) Args Uses

func (page Page) Args() Int

Args returns the number of arguments to this page.

func (Page) Equals Uses

func (page Page) Equals(b Page) qlova.Bool

Equals returns true if page is equal to b.

func (Page) Goto Uses

func (page Page) Goto(args ...String)

Goto goes to the specified page. The provided arguments are provided to the page.

func (Page) SetCurrent Uses

func (page Page) SetCurrent()

SetCurrent sets the current page to this page. This is a low-level API and shouldn't be called. Use Goto instead.

type Promise Uses

type Promise struct {
    // contains filtered or unexported fields

Promise represents a future action that can either succeed or fail.

func (Promise) Catch Uses

func (promise Promise) Catch(f func(err Error)) Promise

Catch executes the provided function when the promise fails.

func (Promise) Then Uses

func (promise Promise) Then(f func(value Dynamic)) Promise

Then executes the provided function when the promise succeeds.

func (Promise) Wait Uses

func (promise Promise) Wait() Dynamic

Wait waits for the promise to complete and returns the resulting value.

type Seed Uses

type Seed struct {

    ID, Native string
    Q          Ctx

Seed is the script interface to a seed.Seed

func (Seed) Add Uses

func (seed Seed) Add(child Seed)

Add a child seed to this seed.

func (Seed) Blur Uses

func (seed Seed) Blur()

Blur removes focus from the seed.

func (Seed) Bytes Uses

func (seed Seed) Bytes() []byte

Bytes TODO this is unimplemented.

func (Seed) CSS Uses

func (seed Seed) CSS() css.Style

CSS implements css.Stylable

func (Seed) ClearGradient Uses

func (seed Seed) ClearGradient()

ClearGradient clears the gradient of the seed.

func (Seed) Click Uses

func (seed Seed) Click()

Click simulates a click on this seed.

func (Seed) Column Uses

func (seed Seed) Column() Bool

Column returns true if this is a column layout.

func (Seed) Data Uses

func (seed Seed) Data(property String) String

Data returns the data associated with this seed.

func (Seed) Element Uses

func (seed Seed) Element() string

Element returns the seed as an HTML element.

func (Seed) File Uses

func (seed Seed) File() File

File returns the first file of this seed.

func (Seed) Filter Uses

func (seed Seed) Filter(f func(child Seed))

Filter runs a function on each child of this seed.

func (Seed) Focus Uses

func (seed Seed) Focus()

Focus focuses the seed for input.

func (Seed) Get Uses

func (seed Seed) Get(property string) string

Get returns the CSS property of this seed.

func (Seed) HTML Uses

func (seed Seed) HTML() String

HTML returns the HTML of this seed.

func (Seed) Hidden Uses

func (seed Seed) Hidden() qlova.Bool

Hidden returns true if the seed is hidden.

func (Seed) Javascript Uses

func (seed Seed) Javascript(js string)

Javascript is shorthand for seed.Q.Javascript

func (Seed) Load Uses

func (seed Seed) Load(f File)

Load sets the resource location of this seed to the specified file.

func (Seed) OnClick Uses

func (seed Seed) OnClick(f func())

OnClick sets the onclick event of this seed.

func (Seed) Pause Uses

func (seed Seed) Pause()

Pause calls pause on the seed and returns the resulting promise.

func (Seed) Play Uses

func (seed Seed) Play() Promise

Play calls play on the seed and returns the resulting promise.

func (Seed) RemoveTint Uses

func (seed Seed) RemoveTint()

RemoveTint removes the tint of this seed. Color must be known at runtime.

func (Seed) Restart Uses

func (seed Seed) Restart()

Restart calls the load method on the seed.

func (Seed) Row Uses

func (seed Seed) Row() Bool

Row returns true if this is a row layout.

func (Seed) Scale Uses

func (seed Seed) Scale(scalar Float)

Scale sets the scale of this seed to the specified scalar.

func (Seed) Set Uses

func (seed Seed) Set(property, value string)

Set sets the CSS style property to value.

func (Seed) SetAnimation Uses

func (seed Seed) SetAnimation(animation *Animation)

SetAnimation sets and plays the given animtion.

func (Seed) SetAnimationDuration Uses

func (seed Seed) SetAnimationDuration(duration Float)

SetAnimationDuration sets the duration that the animation should play for.

func (Seed) SetAnimationIterations Uses

func (seed Seed) SetAnimationIterations(iterations Int)

SetAnimationIterations sets how many times the animation should play. 0 for infinite.

func (Seed) SetAnimationReverse Uses

func (seed Seed) SetAnimationReverse()

SetAnimationReverse sets the animation to play in reverse.

func (Seed) SetClass Uses

func (seed Seed) SetClass(value String)

SetClass sets the class name of this seed.

func (Seed) SetColor Uses

func (seed Seed) SetColor(c Color)

SetColor sets the color of this seed.

func (Seed) SetColumn Uses

func (seed Seed) SetColumn()

SetColumn causes the seed to act as a column layout.

func (Seed) SetData Uses

func (seed Seed) SetData(property, data String)

SetData sets string Data associated with this seed.

func (Seed) SetDynamic Uses

func (seed Seed) SetDynamic(property, value string)

SetDynamic sets the CSS style property to dynamic value.

func (Seed) SetGradient Uses

func (seed Seed) SetGradient(direction complex128, start, end Color)

SetGradient sets the gradient of the seed.

func (Seed) SetHTML Uses

func (seed Seed) SetHTML(s String)

SetHTML sets the HTML of the seed.

func (Seed) SetHidden Uses

func (seed Seed) SetHidden()

SetHidden sets the seed to be hidden.

func (Seed) SetInvisible Uses

func (seed Seed) SetInvisible()

SetInvisible causes the seed to still take up space but be hidden from view.

func (Seed) SetOnlineSource Uses

func (seed Seed) SetOnlineSource(s String)

SetOnlineSource sets the resource source/path of the seed.

func (Seed) SetPath Uses

func (seed Seed) SetPath(s String)

SetPath sets the resource source/path of the seed.

func (Seed) SetPlaceholder Uses

func (seed Seed) SetPlaceholder(value String)

SetPlaceholder sets the input placeholder of the seed.

func (Seed) SetRow Uses

func (seed Seed) SetRow()

SetRow causes the seed to act as a row layout.

func (Seed) SetSource Uses

func (seed Seed) SetSource(s String)

SetSource sets the resource source/path of the seed.

func (Seed) SetText Uses

func (seed Seed) SetText(s String)

SetText sets the text of the string.

func (Seed) SetTint Uses

func (seed Seed) SetTint(tint color.Color)

SetTint sets the tint of this seed. Color must be known at runtime.

func (Seed) SetValue Uses

func (seed Seed) SetValue(value String)

SetValue sets the input value of the seed.

func (Seed) SetVisible Uses

func (seed Seed) SetVisible()

SetVisible causes the seed to take up space and be visible.

func (Seed) Source Uses

func (seed Seed) Source() String

Source returns the source of the seed.

func (Seed) Text Uses

func (seed Seed) Text() String

Text returns the text of this seed.

func (Seed) Translate Uses

func (seed Seed) Translate(x, y Unit)

Translate sets the transform of this seed to the specified translation.

func (Seed) URL Uses

func (seed Seed) URL() String

URL returns the url/link of this seed.

func (Seed) Value Uses

func (seed Seed) Value() String

Value returns the input value of this seed.

func (Seed) Visible Uses

func (seed Seed) Visible() qlova.Bool

Visible returns true if the seed is visible.

func (Seed) Width Uses

func (seed Seed) Width() Unit

Width returns the width of the seed.

type String Uses

type String = qlovascript.String

String is the script string type.

type Time Uses

type Time struct {
    Q   Ctx

Time is a script interface to a time value.

func (Time) Day Uses

func (t Time) Day() Int

Day returns the day of the month specified by t.

func (Time) Month Uses

func (t Time) Month() Month

Month returns the month of the year specified by t.

func (Time) String Uses

func (t Time) String() String

func (Time) Unix Uses

func (t Time) Unix() Int

Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC. The result does not depend on the location associated with t.

type Type Uses

type Type = qlovascript.Type

Type is a qlovascript type.

type URL Uses

type URL struct {
    // contains filtered or unexported fields

URL is a reference to a resource/location on the internet.

func (URL) Goto Uses

func (url URL) Goto()

Goto goes directly to the URL if possible..

func (URL) Open Uses

func (url URL) Open()

Open opens the URL in a new tab if possible.

type Unit Uses

type Unit qlova.String

Unit is a display unit, eg. px, em, %

type Value Uses

type Value = qlovascript.Value

type Website Uses

type Website = URL

Website is an alias to URL.



Package script imports 18 packages (graph) and is imported by 8 packages. Updated 2020-07-14. Refresh now. Tools for package owners.