custom-belt-lib / Modules / BeltSystem / BeltSystem
Class: BeltSystem
BeltSystem.BeltSystem
Class used to represent predefined belt systems
Table of contents
Constructors
Properties
Methods
- getBeltById
- getBeltByName
- getBeltProps
- getBeltPropsAll
- getBeltPropsById
- getBeltPropsByIds
- getBeltPropsByName
- getBeltPropsByNames
- getBeltsByIds
- getBeltsByNames
Constructors
constructor
• new BeltSystem(system)
Instantiate a new BeltSystem object
Parameters
| Name | Type | Description |
|---|---|---|
system | string | belt system object to use |
Defined in
Properties
belts
• belts: Belt[]
belts in the system
Defined in
colors
• colors: BeltColor[]
lookup table of friendly color names to hex codes
Defined in
name
• name: string
name of belt system
Defined in
refreshInterval
• refreshInterval: number
refresh interval in milliseconds
Defined in
title
• title: string
title of belt system
Defined in
transitionCSS
• transitionCSS: string
transition CSS
Defined in
Methods
getBeltById
▸ getBeltById(id): undefined | Belt
Get a Belt by Id
Parameters
| Name | Type | Description |
|---|---|---|
id | number | belt id to find |
Returns
undefined | Belt
matching Belt or undefined
Defined in
getBeltByName
▸ getBeltByName(name): undefined | Belt
Get a Belt by Name (case insensitive search)
Parameters
| Name | Type | Description |
|---|---|---|
name | string | belt name to find |
Returns
undefined | Belt
matching Belt or undefined
Defined in
getBeltProps
▸ getBeltProps(belt, stripeCount, stripePosition?, callback?): BeltProps
Get BeltpProps for provided Belt object and stripe info
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
belt | Belt | undefined | belt object to use |
stripeCount | number | undefined | number of stripes to use (0-10) |
stripePosition | undefined | StripePosition | undefined | stripe placement |
callback? | (callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => void | undefined | - |
Returns
BeltProps for provided Belt object and stripe info
Defined in
getBeltPropsAll
▸ getBeltPropsAll(transitionCSS?, refreshInterval?, callback?): BeltProps[]
Get all BeltProps from the belt system
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
transitionCSS | string | '' | transition css to use between belt changes. Empty for no effect |
refreshInterval | number | 0 | milliseconds to wait before changing belt. 0 for no rotate |
callback? | (callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => void | undefined | - |
Returns
all belts in the belt system
Defined in
getBeltPropsById
▸ getBeltPropsById(id, stripeCount?, stripePosition?, callback?): BeltProps[]
Get BeltProps for matching belt id
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
id | number | undefined | belt id to find |
stripeCount | undefined | number | undefined | number of stripes to use (0-10) |
stripePosition | undefined | StripePosition | undefined | stripe placement (Right or Left) |
callback? | (callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => void | undefined | - |
Returns
BeltProps for matching belt name
Defined in
getBeltPropsByIds
▸ getBeltPropsByIds(ids, stripeCount?, stripePosition?, transitionCSS?, refreshInterval?, callback?): BeltProps[]
Get BeltProps for matching belt ids
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
ids | number[] | undefined | ids of belts to return |
stripeCount | undefined | number | undefined | the number of stripes to use |
stripePosition | undefined | StripePosition | undefined | the stripe position to use |
transitionCSS | string | '' | transition css to use between belt changes |
refreshInterval | number | 0 | milliseconds to wait before changing belt |
callback? | (callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => void | undefined | - |
Returns
BeltProps[] of matching belts
Defined in
getBeltPropsByName
▸ getBeltPropsByName(name, stripeCount?, stripePosition?, callback?): BeltProps[]
Get BeltProps for matching belt name
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
name | string | undefined | belt name to find |
stripeCount | undefined | number | undefined | number of stripes to use (0-10) |
stripePosition | undefined | StripePosition | undefined | stripe placement (Right or Left) |
callback? | (callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => void | undefined | - |
Returns
BeltProps for matching belt name
Defined in
getBeltPropsByNames
▸ getBeltPropsByNames(names, stripeCount?, stripePosition?, transitionCSS?, refreshInterval?, callback?): BeltProps[]
Get BeltProps for matching belt names
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
names | string[] | undefined | names of belts to return |
stripeCount | undefined | number | undefined | the number of stripes to use |
stripePosition | undefined | StripePosition | undefined | the stripe position to use |
transitionCSS | string | '' | transition css to use between belt changes |
refreshInterval | number | 0 | milliseconds to wait before changing belt |
callback? | (callbackType: BeltCallbackType, belt: BeltProps, event: null | Event) => void | undefined | - |
Returns
BeltProps[] of matching belts
Defined in
getBeltsByIds
▸ getBeltsByIds(ids): Belt[]
Get matching belts by ids
Parameters
| Name | Type | Description |
|---|---|---|
ids | number[] | ids of belts to return |
Returns
Belt[]
Belt[] of matching belts
Defined in
getBeltsByNames
▸ getBeltsByNames(names): Belt[]
Get matching belts by names
Parameters
| Name | Type | Description |
|---|---|---|
names | string[] | names of belts to return |
Returns
Belt[]
Belt[] of matching belts