[Refactoring] API: Refactor worker provider directory

This commit is contained in:
Alexander Zinchuk 2023-07-23 10:07:49 +02:00
parent 19e02501af
commit 62d3d7cc42
5 changed files with 23 additions and 25 deletions

View File

@ -1,4 +1,4 @@
// export { initApi, callApi, cancelApiProgress } from './provider';
// export { initApi, callApi, cancelApiProgress } from './methods/init';
export {
initApi, callApi, cancelApiProgress, cancelApiProgressMaster, callApiLocal,
handleMethodCallback,
@ -6,4 +6,4 @@ export {
updateFullLocalDb,
updateLocalDb,
setShouldEnableDebugLog,
} from './worker/provider';
} from './worker/connector';

View File

@ -3,26 +3,26 @@ import type {
ApiInitialArgs,
ApiUpdate,
ApiOnProgress,
} from '../types';
import type { Methods, MethodArgs, MethodResponse } from './methods/types';
import type { LocalDb } from './localDb';
} from '../../types';
import type { Methods, MethodArgs, MethodResponse } from './types';
import type { LocalDb } from '../localDb';
import { API_THROTTLE_RESET_UPDATES, API_UPDATE_THROTTLE } from '../../config';
import { throttle, throttleWithTickEnd } from '../../util/schedulers';
import { updateFullLocalDb } from './localDb';
import { init as initUpdater } from './updater';
import { init as initAuth } from './methods/auth';
import { init as initChats } from './methods/chats';
import { init as initMessages } from './methods/messages';
import { init as initUsers } from './methods/users';
import { init as initClient } from './methods/client';
import { init as initStickers } from './methods/symbols';
import { init as initManagement } from './methods/management';
import { init as initTwoFaSettings } from './methods/twoFaSettings';
import { init as initBots } from './methods/bots';
import { init as initCalls } from './methods/calls';
import { init as initPayments } from './methods/payments';
import * as methods from './methods';
import { API_THROTTLE_RESET_UPDATES, API_UPDATE_THROTTLE } from '../../../config';
import { throttle, throttleWithTickEnd } from '../../../util/schedulers';
import { updateFullLocalDb } from '../localDb';
import { init as initUpdater } from '../updater';
import { init as initAuth } from './auth';
import { init as initChats } from './chats';
import { init as initMessages } from './messages';
import { init as initUsers } from './users';
import { init as initClient } from './client';
import { init as initStickers } from './symbols';
import { init as initManagement } from './management';
import { init as initTwoFaSettings } from './twoFaSettings';
import { init as initBots } from './bots';
import { init as initCalls } from './calls';
import { init as initPayments } from './payments';
import * as methods from './index';
let onUpdate: OnApiUpdate;

View File

@ -1 +1 @@
export * from '../../provider';
export * from '../../methods/init';

View File

@ -40,8 +40,6 @@ const savedLocalDb: LocalDb = {
channelPtsById: {},
};
// TODO Re-use `util/WorkerConnector.ts`
let isMasterTab = true;
subscribeToMasterChange((isMasterTabNew) => {
isMasterTab = isMasterTabNew;

View File

@ -4,7 +4,7 @@ import type { ApiOnProgress, ApiUpdate } from '../../types';
import type { OriginMessageEvent, WorkerMessageData } from './types';
import { DEBUG } from '../../../config';
import { callApi, cancelApiProgress, initApi } from '../provider';
import { callApi, cancelApiProgress, initApi } from '../methods/init';
import { log } from '../helpers';
import type { DebugLevel } from '../../../util/debugConsole';
import { DEBUG_LEVELS } from '../../../util/debugConsole';