Module ID: shellfish/core
This module provides the Shellfish Core API.
Classes
- Action
- FileFS
- FileStorage
- Filesystem
- FSModel
- InertialEngine
- ListModel
- Object
- ParallelAction
- RegistryFile
- RegistryOverlay
- Repeater
- RpcProxy
- ScaleModel
- ScriptAction
- SequentialAction
- ThreadPool
- Timer
- TreeModelAdapter
- WaitAction
Methods
-
Creates a dump of the current status for debugging purposes.
This is a very expensive operation giving you details about the objects, their relations, reference counts, and lifecycle status.
The dump must only be used for debugging purposes as its format may be subject to change.
Returns:
Type Description Object The dump. Examples
Dumping to the console (some browsers allow you to navigate it as a tree)
console.log(core.dumpStatus());Dump as string (Warning: the output could become very long!)
console.log(JSON.stringify(core.dumpStatus()));Setup dumping on pressing Ctrl+D in a Shui document
Document { onKeyDown: (ev) => { if (ev.key === "d" && ev.ctrlKey) { console.log(core.dumpStatus()); ev.accepted = true; // this key-press was handled and should not bubble up further } } } -
Formats a bytes number to a string.
Name Type Description bytesnumber The bytes number to format.
Returns:
Type Description string The formatted string. -
Generates a random UID string. The UID is unique within the Shellfish environment where it was generated.
Returns:
Type Description string The generated UID.
Type Definitions
-
A color value.
Properties:
Name Type Description rnumber The red value within the range of 0.0 and 1.0.
gnumber The green value within the range of 0.0 and 1.0.
bnumber The blue value within the range of 0.0 and 1.0.
anumber The alpha value within the range of 0.0 and 1.0.
toArrayfunction Returns an array of the
[r, g, b, a]values.toCssfunction Returns a CSS string defining the color.
alphafunction Returns a new Color object with the alpha channel replaced by the given value.
brightnessfunction Returns a new Color object with the brightness adjusted by the given factor.
saturationfunction Returns a new Color object with the saturation adjusted by the given factor.
-
A directional vector in 2D space.
Properties:
Name Type Description xnumber The X value.
ynumber The Y value.
lengthfunction Returns the length of the vector.
scalefunction Returns a scaled copy of the vector.
addfunction Returns a new Vec2 object with another vector added to this vector.
subfunction Returns a new Vec2 object with another vector subtracted from this vector.
-
A directional vector in 3D space.
Properties:
Name Type Description xnumber The X value.
ynumber The Y value.
znumber The Z value.
lengthfunction Returns the length of the vector.
scalefunction Returns a scaled copy of the vector.
addfunction Returns a new Vec3 object with another vector added to this vector.
subfunction Returns a new Vec3 object with another vector subtracted from this vector.