Home > @unseenco/backstage-core > ISequence > pointer
ISequence.pointer property
A Pointer to the sequence's inner state.
Signature:
typescript
pointer: Pointer<{
playing: boolean;
length: number;
position: number;
}>;Remarks
As with any Pointer, you can use this with onChange() to listen to its value changes or with val() to read its current value.
Example
Usage
ts
import {onChange, val} from '@unseenco/backstage'
// let's assume `sheet` is a sheet
const sequence = sheet.sequence
onChange(sequence.pointer.length, (len) => {
console.log("Length of the sequence changed to:", len)
})
onChange(sequence.pointer.position, (position) => {
console.log("Position of the sequence changed to:", position)
})
onChange(sequence.pointer.playing, (playing) => {
console.log(playing ? 'playing' : 'paused')
})
// we can also read the current value of the pointer
console.log('current length is', val(sequence.pointer.length))