import InputControl from './controls/InputControl'; import EventEmitter from './util/EventEmitter'; export type DeviceOptions = { /** * Determines initial value for `.enabled`, whether devices is initially * enabled upon creation. * * default: true */ enabled?: boolean; }; export type DeviceEvents = { change: unknown; [k: string]: unknown; }; /** * An abstract class for hardware devices, such as {@link devices/Keyboard.Keyboard}. * * Extend this class to create new devices. */ export declare abstract class Device extends EventEmitter { /** * Create a new InputControl object attached to the device. */ getControl: (name: any, options?: any) => InputControl; /** * Remove any event listeners and free up any resources. */ destroy: () => void; /** * Devices that are not enabled will not emit any events, and read operations * will always return the default value, which is typically 0. */ enabled: boolean; /** * `true` if device is currently connected. */ readonly connected: boolean; } export interface ThrottledDeviceOptions extends DeviceOptions { /** * For {@link Device.ThrottledDevice | throttled devices}, `updatePeriod` determines the minimal * length of time between samples. Shorter periods (and therefore higher frequency) * might improve responsiveness but may impact performance and limit accuracy * of "delta" values between samples. */ updatePeriod?: number; } /** * An abstract class for devices whose input may be throttled to prevent changes * happening too frequently. Derived classes typically take {@link Device.ThrottledDeviceOptions} * as a constructor argument. * * Extend this class to create new throttled devices. */ export declare abstract class ThrottledDevice extends Device { /** * The time (DOMHighResTimeStamp) of the last input read from the device hardware, * in milliseconds, representing time since "time origin," or the beginning of * the document's lifetime. */ readonly timestamp: number; } /** * An abstract class for devices that require polling, since the underlying hardware * API may not provide any events triggered by value changes. * * Extend this class to create new polling devices. */ export declare abstract class PollingDevice extends ThrottledDevice { /** * The `update` method must be called during the game loop, typically `requestAnimationFrame` * for the device to emit changes and update read values. */ update: () => void; }