2020-10-07 23:49:52 +03:00
|
|
|
import MTPNetworker from "./networker";
|
2020-06-06 09:39:35 +03:00
|
|
|
import { InvokeApiOptions } from "../../types";
|
2020-10-07 23:49:52 +03:00
|
|
|
import MTTransport from "./transports/transport";
|
2020-02-06 22:43:07 +07:00
|
|
|
|
|
|
|
export class NetworkerFactory {
|
|
|
|
public updatesProcessor: (obj: any, bool: boolean) => void = null;
|
|
|
|
|
|
|
|
public setUpdatesProcessor(callback: (obj: any, bool: boolean) => void) {
|
|
|
|
this.updatesProcessor = callback;
|
|
|
|
}
|
|
|
|
|
2020-10-07 23:49:52 +03:00
|
|
|
public getNetworker(dcID: number, authKey: number[], authKeyID: Uint8Array, serverSalt: number[], transport: MTTransport, options: InvokeApiOptions) {
|
2020-06-06 09:39:35 +03:00
|
|
|
//console.log('NetworkerFactory: creating new instance of MTPNetworker:', dcID, options);
|
2020-10-07 23:49:52 +03:00
|
|
|
return new MTPNetworker(dcID, authKey, authKeyID, serverSalt, transport, options);
|
2020-02-06 22:43:07 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new NetworkerFactory();
|