UNPKG

get-svelte

Version:

A simple, powerful state management library for Svelte applications, inspired by GetX for Flutter

44 lines (43 loc) 1.87 kB
import GetxController from "./GetxController"; import { InnerCaller } from "./InnerCaller"; /** * Interface defining the parameters required for creating a GetxControllerID instance. * This represents the identification and metadata for a controller in the Get system. */ export interface GetxControllerIDParams { id: string; type: string; tag: string | undefined; controller: GetxController; innerCaller: InnerCaller; controllerConstructor: new (...args: any[]) => GetxController; } /** * Class representing a unique identifier for a GetxController instance. * Stores metadata about the controller including its identifier, type, and tag * along with references to the controller and its inner caller. */ export default class GetxControllerID { /** Unique identifier for the controller */ readonly id: string; /** Optional tag for categorizing or finding controllers */ readonly tag: string | undefined; /** Type name of the controller, typically the class name */ readonly type: string; /** Reference to the actual controller instance */ readonly controller: GetxController; /** Reference to the controller's inner caller for lifecycle management */ readonly innerCaller: InnerCaller; /** Reference to the constructor function for reliable type matching */ readonly controllerConstructor: new (...args: any[]) => GetxController; /** * Creates a new GetxControllerID instance. * @param {GetxControllerIDParams} params - The parameters for initializing the controller ID */ constructor({ id, type, tag, controller, innerCaller, controllerConstructor: ctorRef }: GetxControllerIDParams); /** * Lifecycle hook called when the controller is deleted. * This method can be overridden by subclasses to perform cleanup actions. */ onDelete(): void; }