@bcswaper/apis
Version:
bcswaper apis
1 lines • 377 B
JavaScript
export class TickerHandler{constructor(c="ETH-USD",t){this.currentPrice=0,this.symbol=c,this.clientCallBackFuncs=t}async resolve(c){if(0===c?.length)return;const t=c[0].last;this.resetPrice(t)}resetPrice(c){c!==this.currentPrice&&(this.currentPrice=c,this.clientCallBackFuncs.tickFunc&&this.clientCallBackFuncs.tickFunc(this.currentPrice))}getPrice(){return this.currentPrice}}