import type { IReset } from "@thi.ng/api" ; import { AGen } from "./agen.js" ; /**
 * Numeric version of  impulseT , using given `on` (default: 1) as
 * initial value and zero for the remaining values.
 *
 *  param on export const impulse = ( on = 1 ) => new Impulse ( on , 0 ) ; /**
 * Creates a new impulse gen, producing a single `on` for the first
 * invocation of  IGen . next , then only `off` thereafter.
 *
 *  param on param off export const impulseT = < T > ( on , off ) => new Impulse < T > ( on , off ) ; /**
 * Boolean version of  impulseT , using given `start` (default:
 * true) as initial value and its inverse for the remaining values.
 *
 *  param start export const impulseB = ( start = true ) => new Impulse ( start , ! start ) ; export class Impulse < T > extends AGen < T > implements IReset { constructor ( protected _on , protected _off ) { super ( _on ) ; } reset ( ) { this . _val = this . _on ; return this ; } next ( ) { const x = this . _val ; this . _val = this . _off ; return x ; } }