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
console.log(core.dumpStatus());
console.log(JSON.stringify(core.dumpStatus()));
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 bytes
number 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 r
number The red value within the range of 0.0 and 1.0.
g
number The green value within the range of 0.0 and 1.0.
b
number The blue value within the range of 0.0 and 1.0.
a
number The alpha value within the range of 0.0 and 1.0.
toArray
function Returns an array of the
[r, g, b, a]
values.toCss
function Returns a CSS string defining the color.
alpha
function Returns a new Color object with the alpha channel replaced by the given value.
brightness
function Returns a new Color object with the brightness adjusted by the given factor.
saturation
function Returns a new Color object with the saturation adjusted by the given factor.
-
A directional vector in 2D space.
Properties:
Name Type Description x
number The X value.
y
number The Y value.
length
function Returns the length of the vector.
scale
function Returns a scaled copy of the vector.
add
function Returns a new Vec2 object with another vector added to this vector.
sub
function Returns a new Vec2 object with another vector subtracted from this vector.
-
A directional vector in 3D space.
Properties:
Name Type Description x
number The X value.
y
number The Y value.
z
number The Z value.
length
function Returns the length of the vector.
scale
function Returns a scaled copy of the vector.
add
function Returns a new Vec3 object with another vector added to this vector.
sub
function Returns a new Vec3 object with another vector subtracted from this vector.