Documentation
¶
Rendered for darwin/amd64
Index ¶
- Constants
- Variables
- func CheckID(id string) error
- func DecodeText(data []byte, fatal bool) (text string, restored int, ok bool)
- func EncodeManifest(manifest Manifest) ([]byte, error)
- func FailureOf(err error) string
- func FileNotFound(where, name string) error
- func IsNewer(remote Manifest, version string, versionCode int64) bool
- func Message(err error) string
- type ActionInfo
- type Archive
- type ArchiveFile
- type CallRequest
- type Caller
- type DatabaseChange
- type Dialog
- type Failure
- type FileInfo
- type FileWriter
- type Frame
- type Graphics
- type GraphicsCall
- func (c *GraphicsCall) Authorize(name string, write bool) error
- func (c *GraphicsCall) Context() context.Context
- func (c *GraphicsCall) Screenshot() ([]byte, float64, error)
- func (c *GraphicsCall) Trace(at time.Time, name, detail string, duration time.Duration)
- func (c *GraphicsCall) Tracing() bool
- func (c *GraphicsCall) WatchTimeline() *TimelineWatch
- type Host
- func (h *Host) AwaitService(ctx context.Context, id string, enabled bool, requested time.Time) (ServiceState, error)
- func (h *Host) Call(ctx context.Context, request CallRequest) (json.RawMessage, error)
- func (h *Host) ClearData(id string) error
- func (h *Host) Close()
- func (h *Host) CloseDatabases(client any, swiplet string)
- func (h *Host) Install(archive io.ReaderAt, size int64) (Swiplet, error)
- func (h *Host) ListFiles(id, kind, name string) (files []FileInfo, err error)
- func (h *Host) Log(swiplet string, level log.Level, message string)
- func (h *Host) NewREPL(dialog Dialog) *REPL
- func (h *Host) OpenWeb(id string) (*WebSession, error)
- func (h *Host) ReadFile(id, kind, name string) (data []byte, err error)
- func (h *Host) Remove(id string) error
- func (h *Host) RemoveFile(id, kind, name string) error
- func (h *Host) RetryServices()
- func (h *Host) SQLite(client any, swiplet string, request []byte) (any, error)
- func (h *Host) Service(id string) (ServiceState, error)
- func (h *Host) SetServiceEnabled(id string, enabled bool) error
- func (h *Host) Start()
- func (h *Host) Swiplet(id string) (Swiplet, error)
- func (h *Host) Swiplets() ([]Swiplet, error)
- func (h *Host) WatchDatabases(ctx context.Context, swiplet string, publish func(DatabaseChange))
- func (h *Host) WatchServiceLogs(ctx context.Context, id string, observe func(LogEntry)) error
- func (h *Host) WatchServices(ctx context.Context, observe func(id string, state ServiceState)) error
- func (h *Host) WriteFile(id, kind, name string, data []byte) error
- type Icon
- type LogEntry
- type Manifest
- type Options
- type Output
- type OutputKind
- type REPL
- type Script
- type ServiceState
- type ServiceStatus
- type Swiplet
- type TimeLimitError
- type TimelineEvent
- type TimelineWatch
- type WebSession
- func (s *WebSession) Cancel(id string)
- func (s *WebSession) Close()
- func (s *WebSession) Compression(format, mode string) ([]string, error)
- func (s *WebSession) Digest(algorithm string, data []byte) ([]byte, error)
- func (s *WebSession) OpenFile(kind, name string) string
- func (s *WebSession) Put(data []byte) string
- func (s *WebSession) Random(length int) ([]byte, error)
- func (s *WebSession) Release(id, reason string)
- func (s *WebSession) Start(id, name, encoded string, done func(value any, err error))
Constants ¶
View Source
const ( SourceFolder = "src" AssetsFolder = "assets" DataFolder = "data" InterfaceFile = "app.js" ExtensionFile = "extension.js" ExtensionMap = "extension.js.map" ManifestFile = "manifest.json" IconFile = "icon.png" )
View Source
const (
REPLDirectory = "@repl"
)
View Source
const UpdateGuide = "https://swipt.io/"
Variables ¶
View Source
var ( ErrNotFound = E.New("not found") ErrNotAllowed = E.New("not allowed") ErrInvalid = device.ErrInvalid ErrOutdated = E.New("Swipt is outdated") )
View Source
var DefaultIcon = Icon{Color: "grayBrown", Symbol: "square.2.layers.3d.fill"}
View Source
var ErrDismissed = E.New("the person dismissed the dialog")
Functions ¶
func EncodeManifest ¶
func FileNotFound ¶
Types ¶
type ActionInfo ¶
type ActionInfo struct {
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Expose []Caller `json:"expose,omitempty"`
Input json.RawMessage `json:"input,omitempty"`
Output json.RawMessage `json:"output,omitempty"`
}
type Archive ¶
type Archive struct {
Manifest Manifest
Files []ArchiveFile
}
type ArchiveFile ¶
type CallRequest ¶
type DatabaseChange ¶
type Failure ¶
type Failure struct {
Name string `json:"name"`
Message string `json:"message"`
Stack []Frame `json:"stack"`
}
func ScriptFailure ¶
type FileWriter ¶
func (*FileWriter) Finish ¶
func (w *FileWriter) Finish(abort error) error
type Graphics ¶
type Graphics interface {
Entry() uintptr
Run(engine uint64, call int64, context *GraphicsCall) (json.RawMessage, error)
Watch(engine uint64, call int64, context *GraphicsCall, publish func(any)) error
}
type GraphicsCall ¶
type GraphicsCall struct {
// contains filtered or unexported fields
}
func (*GraphicsCall) Context ¶
func (c *GraphicsCall) Context() context.Context
func (*GraphicsCall) Screenshot ¶
func (c *GraphicsCall) Screenshot() ([]byte, float64, error)
func (*GraphicsCall) Tracing ¶
func (c *GraphicsCall) Tracing() bool
func (*GraphicsCall) WatchTimeline ¶
func (c *GraphicsCall) WatchTimeline() *TimelineWatch
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
func (*Host) AwaitService ¶
func (*Host) Call ¶
func (h *Host) Call(ctx context.Context, request CallRequest) (json.RawMessage, error)
func (*Host) CloseDatabases ¶
func (*Host) RemoveFile ¶
func (*Host) RetryServices ¶
func (h *Host) RetryServices()
func (*Host) WatchDatabases ¶
func (h *Host) WatchDatabases(ctx context.Context, swiplet string, publish func(DatabaseChange))
func (*Host) WatchServiceLogs ¶
func (*Host) WatchServices ¶
type Manifest ¶
type Manifest struct {
ID string
Name string
LocalizedNames map[string]string
Description string
Version string
VersionCode int64
Icon Icon
UpdateURL string
MinimumAPILevel int64
Interface bool
Service bool
Actions []ActionInfo
// contains filtered or unexported fields
}
func LoadManifest ¶
func ParseManifest ¶
type Output ¶
type Output struct {
Kind OutputKind
Level log.Level
Text string
JSON json.RawMessage
Image []byte
}
type OutputKind ¶
type OutputKind int
const ( OutputConsole OutputKind = iota OutputValue OutputImage )
type ServiceState ¶
type ServiceStatus ¶
type ServiceStatus string
const ( ServiceStarting ServiceStatus = "starting" ServiceRunning ServiceStatus = "running" ServiceStopped ServiceStatus = "stopped" ServiceFailed ServiceStatus = "failed" )
type TimeLimitError ¶
func (*TimeLimitError) Error ¶
func (e *TimeLimitError) Error() string
func (*TimeLimitError) Is ¶
func (e *TimeLimitError) Is(target error) bool
type TimelineEvent ¶
type TimelineEvent struct {
Time int64 `json:"time"`
Type string `json:"type"`
Name string `json:"name,omitempty"`
Arguments []json.RawMessage `json:"arguments,omitempty"`
DurationMs float64 `json:"durationMs,omitempty"`
Error string `json:"error,omitempty"`
Swiplet string `json:"swiplet,omitempty"`
Action string `json:"action,omitempty"`
Caller string `json:"caller,omitempty"`
App string `json:"app,omitempty"`
Level string `json:"level,omitempty"`
Message string `json:"message,omitempty"`
}
type TimelineWatch ¶
type TimelineWatch struct {
// contains filtered or unexported fields
}
func (*TimelineWatch) Stop ¶
func (w *TimelineWatch) Stop() []TimelineEvent
type WebSession ¶
type WebSession struct {
// contains filtered or unexported fields
}
func (*WebSession) Cancel ¶
func (s *WebSession) Cancel(id string)
func (*WebSession) Close ¶
func (s *WebSession) Close()
func (*WebSession) Compression ¶
func (s *WebSession) Compression(format, mode string) ([]string, error)
func (*WebSession) Digest ¶
func (s *WebSession) Digest(algorithm string, data []byte) ([]byte, error)
func (*WebSession) OpenFile ¶
func (s *WebSession) OpenFile(kind, name string) string
func (*WebSession) Put ¶
func (s *WebSession) Put(data []byte) string
func (*WebSession) Release ¶
func (s *WebSession) Release(id, reason string)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.