/** * This is a simpler version of `Record` which do not rely * on index type checks to determine whether a type is an object * or not. Unlike the `object` type, this has an additional checks * to exclude `Array`, and are intended to be used in an `extends` clause. */ type AnyRecord = any[] extends T ? never : object; /** * * @see https://github.com/developit/mitt * Duplicate implementation of mitt. Ported to wpe-lite-packages * for internal usage and internal modification. * * The MIT License (MIT) * Copyright (c) 2021 Jason Miller * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ export type Handler = (event: T) => void; export type WildcardHandler> = (type: keyof T, event: T[keyof T]) => void; export type EventHandlerList = Array>; export type WildCardEventHandlerList> = Array>; export type EventHandlerMap> = Map | WildCardEventHandlerList>; export interface Emitter> { all: EventHandlerMap; on(type: Key, handler: Handler): void; on(type: '*', handler: WildcardHandler): void; off(type: Key, handler?: Handler): void; off(type: '*', handler: WildcardHandler): void; emit(type: Key, event: Events[Key]): void; emit(type: undefined extends Events[Key] ? Key : never): void; } declare function mitt>(all?: EventHandlerMap): Emitter; export default mitt;