import { Disposable , Scheduler , Sink , Stream , Time } from '@most/types' ; import { Behavior } from './index' ; export const snapshotTime = < A > ( stream ) : Stream < [ Time , A ] > => new SnapshotTime ( stream ) ; class SnapshotTime < A > { source : Stream < A > ; constructor ( source ) { this . source = source ; } run ( sink , scheduler ) { return this . source . run ( new SnapshotTimeSink ( sink ) , scheduler ) ; } } class SnapshotTimeSink < A > { sink : Sink < [ Time , A ] > ; constructor ( sink ) { this . sink = sink ; } event ( t , a ) { this . sink . event ( t , [ t , a ] ) ; } error ( t , e ) { this . sink . error ( t , e ) ; } end ( t ) { this . sink . end ( t ) ; } }