clientside

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Catch

func Catch(into *String) seed.Option

Catch copies any raised errors into the provided String.

func Hook

func Hook(v client.Value, c seed.Seed)

Hook renders the given seed whenever the value changes. if v is not a Variable or Compound, this is a noop

func Render

func Render(c seed.Seed) client.Script

Render rerenders the given seed as a client script.

Types

type Address

type Address string

Address is a Memory Address

func NewAddress

func NewAddress() Address

type Bool

type Bool struct {
	Name string

	Memory Memory

	Value client.Bool
	// contains filtered or unexported fields
}

Bool is an bool variable in client memory.

func (*Bool) GetBool

func (b *Bool) GetBool() js.Bool

GetBool implements client.Bool

func (*Bool) GetDefaultValue

func (b *Bool) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*Bool) GetValue

func (b *Bool) GetValue() js.Value

GetValue implements client.Value

func (*Bool) Not

func (b *Bool) Not() *Bool

Not returns a clientside bool that is the inverse of b. Setting the returned bool has the inverse effect.

func (*Bool) OnChange

func (b *Bool) OnChange(do ...client.Script) seed.Option

OnChange runs the given script when the value of this string is changed.

func (*Bool) Protect

func (b *Bool) Protect(do ...client.Script) js.Script

Protect ensures that the given script will only have one running instance.

func (*Bool) Set

func (b *Bool) Set(literal bool) client.Script

Set returns a script that sets the bool to the given literal.

func (*Bool) SetTo

func (b *Bool) SetTo(value client.Bool) client.Script

SetTo returns a script that sets the bool to the given client.Bool.

func (*Bool) Toggle

func (b *Bool) Toggle() client.Script

Toggle returns a script that toggles the boolean between true and false.

func (*Bool) Variable

func (b *Bool) Variable() (Address, Memory)

Variable implements Variable

type File

type File struct {
	Name string

	Memory Memory
	// contains filtered or unexported fields
}

File is a (potentially zipped) file in client memory.

func (*File) GetBool

func (f *File) GetBool() js.Bool

GetBool implements client.Value

func (*File) GetDefaultValue

func (f *File) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*File) GetFile

func (f *File) GetFile() js.Value

GetFile implements client.File

func (*File) GetValue

func (f *File) GetValue() js.Value

GetValue implements client.Value

func (*File) OnChange

func (f *File) OnChange(do ...client.Script) seed.Option

OnChange runs the given script when the value of this string is changed.

func (*File) SetToRaw

func (f *File) SetToRaw(value client.Value) client.Script

SetToRaw returns a script that sets the file to the given client value.

func (*File) Variable

func (f *File) Variable() (Address, Memory)

Variable implements Variable

type Float64

type Float64 struct {
	Name string

	Memory Memory

	Value float64
	// contains filtered or unexported fields
}

Float64 is an float64 variable in client memory.

func (*Float64) GetBool

func (v *Float64) GetBool() js.Bool

GetBool implements client.Value

func (*Float64) GetDefaultValue

func (v *Float64) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*Float64) GetNumber

func (v *Float64) GetNumber() js.Number

GetNumber implements client.Number

func (*Float64) GetValue

func (v *Float64) GetValue() js.Value

GetValue implements client.Value

func (*Float64) Set

func (v *Float64) Set(literal float64) client.Script

Set returns a script that sets the int to the given literal.

func (*Float64) SetTo

func (v *Float64) SetTo(value client.Float) client.Script

SetTo returns a script that sets the string to the given client string.

func (*Float64) Variable

func (v *Float64) Variable() (Address, Memory)

Variable implements Variable

type Int

type Int struct {
	Name string

	Memory Memory

	Value int
	// contains filtered or unexported fields
}

Int is an int variable in client memory.

func (*Int) Add

func (i *Int) Add(literal int) client.Script

Add adds the given literal value to the Int.

func (*Int) GetBool

func (i *Int) GetBool() js.Bool

GetBool implements client.Value

func (*Int) GetDefaultValue

func (i *Int) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*Int) GetNumber

func (i *Int) GetNumber() js.Number

GetNumber implements client.Int

func (*Int) GetValue

func (i *Int) GetValue() js.Value

GetValue implements client.Value

func (*Int) Set

func (i *Int) Set(literal int) client.Script

Set returns a script that sets the int to the given literal.

func (*Int) SetTo

func (i *Int) SetTo(v client.Int) client.Script

SetTo returns a script that sets the int to the given client.Int.

func (*Int) Variable

func (i *Int) Variable() (Address, Memory)

Variable implements Variable

type Memory

type Memory string

Memory is a type of client memory for SideValues.

const (
	ShortTermMemory Memory = ""
	SessionMemory   Memory = "session"
	LongTermMemory  Memory = "storage"

	LocalMemory Memory = "local"
)

Memory types.

type Secret

type Secret struct {
	Name string

	Memory Memory

	//Pepper should be set to a unique random string.
	Pepper string

	//Tweak these values to adjust the hashing difficulty. CPU time and RAM is in KiB.
	//Default is CPU: 1, RAM: 1024
	CPU, RAM int

	//Length is the length of the readable hash of this secret. 32 by default.
	Length int
	// contains filtered or unexported fields
}

Secret is a 'secret' string variable in client memory. Only the hash is available to read from Go. Use this for passwords.

func (*Secret) Equals

func (s *Secret) Equals(b client.String) client.Bool

func (*Secret) GetBool

func (s *Secret) GetBool() js.Bool

GetBool implements script.AnyBool

func (*Secret) GetDefaultValue

func (s *Secret) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*Secret) GetString

func (s *Secret) GetString() js.String

GetString implements script.AnyString

func (*Secret) GetValue

func (s *Secret) GetValue() js.Value

GetValue implements script.AnyValue

func (*Secret) SetTo

func (s *Secret) SetTo(value client.String) client.Script

SetTo returns a script that sets the secret to the given client string.

func (*Secret) Variable

func (s *Secret) Variable() (Address, Memory)

Variable implements Variable

type Set

type Set struct {
	Name string

	Memory Memory

	Value map[interface{}]struct{}
	// contains filtered or unexported fields
}

Set implements a type-safe clientside equivalant to map[interface{}]struct{}

func (*Set) Add

func (s *Set) Add(item client.Value) client.Script

Add adds an item to the set.

func (*Set) Empty

func (s *Set) Empty() client.Script

Empty sets the set to the empty set.

func (*Set) GetBool

func (s *Set) GetBool() js.Bool

GetBool implements client.Value

func (*Set) GetDefaultValue

func (s *Set) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*Set) GetSet

func (s *Set) GetSet() js.Set

GetSet implements js.AnySet

func (*Set) GetValue

func (s *Set) GetValue() js.Value

GetValue implements client.Value

func (*Set) Has

func (s *Set) Has(item client.Value) client.Bool

Has returns true if the set contains the given item.

func (*Set) Remove

func (s *Set) Remove(item client.Value) client.Script

Remove removes the item from the set if it exists.

func (*Set) Variable

func (s *Set) Variable() (Address, Memory)

Variable implements Variable

type Signal

type Signal struct {
	Name string

	Memory Memory

	Value string
	// contains filtered or unexported fields
}

Signal is a communication tool.

func (*Signal) GetBool

func (s *Signal) GetBool() js.Bool

GetBool implements client.Bool

func (*Signal) GetDefaultValue

func (s *Signal) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*Signal) GetFunction

func (s *Signal) GetFunction() js.Function

GetFunction implements client.Function

func (*Signal) GetScript

func (s *Signal) GetScript() js.Script

GetScript implements client.Script

func (*Signal) GetValue

func (s *Signal) GetValue() js.Value

GetValue implements client.Value

func (*Signal) On

func (s *Signal) On(do ...client.Script) seed.Option

On runs the given script when this signal is triggered.

func (*Signal) Variable

func (s *Signal) Variable() (Address, Memory)

Variable implements Variable

type String

type String struct {
	Name string

	Memory Memory

	Value string
	// contains filtered or unexported fields
}

String is a string variable in client memory.

func (*String) GetBool

func (s *String) GetBool() js.Bool

GetBool implements client.Value

func (*String) GetDefaultValue

func (s *String) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*String) GetString

func (s *String) GetString() js.String

GetString implements client.String

func (*String) GetValue

func (s *String) GetValue() js.Value

GetValue implements client.Value

func (*String) GoSet

func (s *String) GoSet(fn interface{}, args ...client.Value) client.Script

GoSet sets the string from a Go function.

func (*String) OnChange

func (s *String) OnChange(do ...client.Script) seed.Option

OnChange runs the given script when the value of this string is changed.

func (*String) Set

func (s *String) Set(literal string) client.Script

Set returns a script that sets the string to the given literal.

func (*String) SetTo

func (s *String) SetTo(value client.String) client.Script

SetTo returns a script that sets the string to the given client string.

func (*String) Variable

func (s *String) Variable() (Address, Memory)

Variable implements Variable

type Value

type Value struct {
	Name string

	Memory Memory

	Value client.Value
	// contains filtered or unexported fields
}

Value is an untyped variable in client memory.

func (*Value) GetBool

func (v *Value) GetBool() js.Bool

GetBool implements client.Bool

func (*Value) GetDefaultValue

func (v *Value) GetDefaultValue() client.Value

GetDefaultValue implements Variable

func (*Value) GetValue

func (v *Value) GetValue() js.Value

GetValue implements client.Value

func (*Value) OnChange

func (v *Value) OnChange(do ...client.Script) seed.Option

OnChange runs the given script when the value of this string is changed.

func (*Value) SetTo

func (v *Value) SetTo(value client.Value) client.Script

SetTo returns a script that sets the value to the given client.Value.

func (*Value) Variable

func (v *Value) Variable() (Address, Memory)

Variable implements Variable

type Variable

type Variable interface {
	Variable() (Address, Memory)
	GetDefaultValue() client.Value
}

Variable is a clientside variable.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL