UNPKG

@ruanitto/react-native-ntp-sync

Version:
28 lines (27 loc) 928 B
import type { Config, Delta, NtpDelta, NtpHistoryChangeHandler, NtpHistory, NtpServer } from './internals/types'; import { NtpClientError } from './internals/error'; export default class NTPSync { private ntpServers; private limit; private tickRate; private syncTimeout; private currentIndex; private tickId; private historyDetails; private isOnline; private listeners; private config; constructor(config?: Partial<Config>); private computeAndUpdate; setIsOnline(isOnline: boolean): void; getIsOnline(): boolean; getDelta: () => Promise<NtpDelta>; getHistory: () => NtpHistory; getTime: () => number; private shiftServer; startAutoSync: () => void; stopAutoSync: () => void; syncTime: () => Promise<boolean>; addListener(listener: NtpHistoryChangeHandler): void; } export { Config, Delta, NtpDelta, NtpHistory, NtpServer, NtpClientError };