Skip to content
On this page

custom-belt-lib / Modules / BeltSystem / BeltSystem

Class: BeltSystem ​

BeltSystem.BeltSystem

Class used to represent predefined belt systems

Table of contents ​

Constructors ​

Properties ​

Methods ​

Constructors ​

constructor ​

• new BeltSystem(system)

Instantiate a new BeltSystem object

Parameters ​

NameTypeDescription
systemstringbelt system object to use

Defined in ​

BeltSystem.ts:49

Properties ​

belts ​

• belts: Belt[]

belts in the system

Defined in ​

BeltSystem.ts:43


colors ​

• colors: BeltColor[]

lookup table of friendly color names to hex codes

Defined in ​

BeltSystem.ts:41


name ​

• name: string

name of belt system

Defined in ​

BeltSystem.ts:33


refreshInterval ​

• refreshInterval: number

refresh interval in milliseconds

Defined in ​

BeltSystem.ts:39


title ​

• title: string

title of belt system

Defined in ​

BeltSystem.ts:35


transitionCSS ​

• transitionCSS: string

transition CSS

Defined in ​

BeltSystem.ts:37

Methods ​

getBeltById ​

▸ getBeltById(id): undefined | Belt

Get a Belt by Id

Parameters ​

NameTypeDescription
idnumberbelt id to find

Returns ​

undefined | Belt

matching Belt or undefined

Defined in ​

BeltSystem.ts:79


getBeltByName ​

▸ getBeltByName(name): undefined | Belt

Get a Belt by Name (case insensitive search)

Parameters ​

NameTypeDescription
namestringbelt name to find

Returns ​

undefined | Belt

matching Belt or undefined

Defined in ​

BeltSystem.ts:88


getBeltProps ​

▸ getBeltProps(belt, stripeCount, stripePosition?, callback?): BeltProps

Get BeltpProps for provided Belt object and stripe info

Parameters ​

NameTypeDefault valueDescription
beltBeltundefinedbelt object to use
stripeCountnumberundefinednumber of stripes to use (0-10)
stripePositionundefined | StripePositionundefinedstripe placement
callback?(callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => voidundefined-

Returns ​

BeltProps

BeltProps for provided Belt object and stripe info

Defined in ​

BeltSystem.ts:99


getBeltPropsAll ​

▸ getBeltPropsAll(transitionCSS?, refreshInterval?, callback?): BeltProps[]

Get all BeltProps from the belt system

Parameters ​

NameTypeDefault valueDescription
transitionCSSstring''transition css to use between belt changes. Empty for no effect
refreshIntervalnumber0milliseconds to wait before changing belt. 0 for no rotate
callback?(callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => voidundefined-

Returns ​

BeltProps[]

all belts in the belt system

Defined in ​

BeltSystem.ts:124


getBeltPropsById ​

▸ getBeltPropsById(id, stripeCount?, stripePosition?, callback?): BeltProps[]

Get BeltProps for matching belt id

Parameters ​

NameTypeDefault valueDescription
idnumberundefinedbelt id to find
stripeCountundefined | numberundefinednumber of stripes to use (0-10)
stripePositionundefined | StripePositionundefinedstripe placement (Right or Left)
callback?(callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => voidundefined-

Returns ​

BeltProps[]

BeltProps for matching belt name

Defined in ​

BeltSystem.ts:148


getBeltPropsByIds ​

▸ getBeltPropsByIds(ids, stripeCount?, stripePosition?, transitionCSS?, refreshInterval?, callback?): BeltProps[]

Get BeltProps for matching belt ids

Parameters ​

NameTypeDefault valueDescription
idsnumber[]undefinedids of belts to return
stripeCountundefined | numberundefinedthe number of stripes to use
stripePositionundefined | StripePositionundefinedthe stripe position to use
transitionCSSstring''transition css to use between belt changes
refreshIntervalnumber0milliseconds to wait before changing belt
callback?(callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => voidundefined-

Returns ​

BeltProps[]

BeltProps[] of matching belts

Defined in ​

BeltSystem.ts:180


getBeltPropsByName ​

▸ getBeltPropsByName(name, stripeCount?, stripePosition?, callback?): BeltProps[]

Get BeltProps for matching belt name

Parameters ​

NameTypeDefault valueDescription
namestringundefinedbelt name to find
stripeCountundefined | numberundefinednumber of stripes to use (0-10)
stripePositionundefined | StripePositionundefinedstripe placement (Right or Left)
callback?(callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => voidundefined-

Returns ​

BeltProps[]

BeltProps for matching belt name

Defined in ​

BeltSystem.ts:215


getBeltPropsByNames ​

▸ getBeltPropsByNames(names, stripeCount?, stripePosition?, transitionCSS?, refreshInterval?, callback?): BeltProps[]

Get BeltProps for matching belt names

Parameters ​

NameTypeDefault valueDescription
namesstring[]undefinednames of belts to return
stripeCountundefined | numberundefinedthe number of stripes to use
stripePositionundefined | StripePositionundefinedthe stripe position to use
transitionCSSstring''transition css to use between belt changes
refreshIntervalnumber0milliseconds to wait before changing belt
callback?(callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => voidundefined-

Returns ​

BeltProps[]

BeltProps[] of matching belts

Defined in ​

BeltSystem.ts:247


getBeltsByIds ​

▸ getBeltsByIds(ids): Belt[]

Get matching belts by ids

Parameters ​

NameTypeDescription
idsnumber[]ids of belts to return

Returns ​

Belt[]

Belt[] of matching belts

Defined in ​

BeltSystem.ts:280


getBeltsByNames ​

▸ getBeltsByNames(names): Belt[]

Get matching belts by names

Parameters ​

NameTypeDescription
namesstring[]names of belts to return

Returns ​

Belt[]

Belt[] of matching belts

Defined in ​

BeltSystem.ts:297

Released under the MIT License.