UNPKG

@metamask/polling-controller

Version:

Polling Controller is the base for controllers that polling by networkClientId

1 lines 1.14 kB
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json } from '@metamask/utils';\n\nexport type PollingTokenSetId = string;\n\nexport type IPollingController<PollingInput extends Json> = {\n startPolling(input: PollingInput): string;\n\n stopAllPolling(): void;\n\n stopPollingByPollingToken(pollingToken: string): void;\n\n onPollingComplete(\n input: PollingInput,\n callback: (input: PollingInput) => void,\n ): void;\n\n _executePoll(input: PollingInput): Promise<void>;\n _startPolling(input: PollingInput): void;\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;\n};\n\n/**\n * TypeScript enforces this type for mixin constructors.\n *\n * Removing the `any` type results in the following error:\n * 'A mixin class must have a constructor with a single rest parameter of type 'any[]'.ts(2545)'\n *\n * A potential future refactor that removes the mixin pattern may be able to fix this.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Constructor = new (...args: any[]) => object;\n"]}