Skip to content

Latest commit

 

History

History
157 lines (100 loc) · 3.21 KB

FuseComponent.md

File metadata and controls

157 lines (100 loc) · 3.21 KB

Class: FuseComponent

Types

<ComponentProps>

See <ComponentProps>


<FuseComponentProps>

A portion of the configuration object to pass to the FuseComponent constructor.

type FuseComponentPropsV1 = {
  isFinished?: boolean | undefined;
  isLit?: boolean | undefined;
  currentFuseAmount?: number | undefined;
};

type FuseComponentProps = FuseComponentPropsV1;

Since v1

  • isFinished (optional, default false) <boolean>
  • isLit (optional, default false) <boolean>
  • currentFuseAmount (optional, default 1) <number>

Constructors

new FuseComponent(props)

Creates a versioned Fuse component.

import { FuseComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new FuseComponent({ version: componentVersion });

FuseComponent.fromBinary(reader, version)

See Component.fromBinary(reader, version)

Properties

Note that the following properties are sorted in order of appearance when decoding component binary data.

hash

See Component.hash


name

See Component.name


version

See Component.version


isFinished

Whether the fuse is finished or not.

  • Since: v1
  • <boolean>
import { FuseComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new FuseComponent({ version: componentVersion });

const isFinished = component.isFinished;
// `isFinished` is `false`

isLit

Whether the fuse is lit or not.

  • Since: v1
  • <boolean>
import { FuseComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new FuseComponent({ version: componentVersion });

const isLit = component.isLit;
// `isLit` is `false`

currentFuseAmount

How much of the fuse is left.

  • Since: v1
  • <number> A number between 0 and 1 (inclusive).
import { FuseComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new FuseComponent({ version: componentVersion });

const currentFuseAmount = component.currentFuseAmount;
// `currentFuseAmount` is `1`

Methods

toBinary(version?)

See Component.toBinary(version?)


write(writer, version?)

See Component.write(writer, version?)