16 lines
423 B
TypeScript
16 lines
423 B
TypeScript
|
import util from './util';
|
||
|
|
||
|
export class Subscriber {
|
||
|
private _reqFn: (filter: string)=>void;
|
||
|
|
||
|
constructor(gateway: string, adapter: string, target: string | null) {
|
||
|
this._reqFn = (filter: string) => {
|
||
|
let url = `${gateway}/api/adapters/${adapter}/subscribe`
|
||
|
util.authorizedFetch("POST", url, JSON.stringify({filter, target}));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
subscribe(filter: string) {
|
||
|
this._reqFn(filter);
|
||
|
}
|
||
|
}
|