Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logVerbosityLevel: verbosity,
jsLogVerbosityLevel: jsVerbosity,
mode: mode, // 'wasm-streaming'/'wasm'/'asmjs'
prefix: useTestDC ? 'tdlib_test' : 'tdlib',
readOnly: readOnly,
isBackground: false,
useDatabase: useDatabase,
wasmUrl: `${WASM_FILE_NAME}?_sw-precache=${WASM_FILE_HASH}`
// onUpdate: update => this.emit('update', update)
};
console.log(
`[TdLibController] (fast_updating=${fastUpdating}) Start client with params=${JSON.stringify(options)}`
);
this.client = new TdClient(options);
this.client.onUpdate = update => {
if (!this.disableLog) {
if (update['@type'] === 'updateFile') {
console.log('receive updateFile file_id=' + update.file.id, update);
} else {
console.log('receive update', update);
}
}
this.emit('update', update);
};
});
};
public initialize (
handleUpdate: (update: Record) => Promise,
handleError: (error: any) => void,
models: ag.PlainObjectToModelTransformer
): void {
this.handleUpdate = handleUpdate
this.handleError = handleError
this.models = models
this.client = new TdWebClient({
...this.config,
onUpdate: (update) => this.handleUpdate(this.deserialize(update))
})
}