@rbxts/reflex-class
Advanced tools
Comparing version 1.0.3 to 1.0.4
import { Janitor } from "@rbxts/janitor"; | ||
import { Producer } from "@rbxts/reflex"; | ||
export type InferClassProducerState<T> = T extends ClassProducer<infer S> ? S : never; | ||
export declare abstract class ClassProducer<S extends object = object> { | ||
export interface IClassProducer<S extends object = object> { | ||
GetState(): S; | ||
Subscribe(listener: (state: S, previousState: S) => void): () => void; | ||
Subscribe<T>(selector: (state: S) => T, listener: (state: T, previousState: T) => void): () => void; | ||
Subscribe<T>(selector: (state: S) => T, predicate: ((state: T, previousState: T) => boolean) | undefined, listener: (state: T, previousState: T) => void): () => void; | ||
Subscribe<T>(...args: unknown[]): () => void; | ||
Dispatch(newState: S): void; | ||
Destroy(): void; | ||
} | ||
export declare abstract class ClassProducer<S extends object = object> implements IClassProducer { | ||
protected abstract state: S; | ||
@@ -16,2 +25,3 @@ protected producer: Producer<S>; | ||
__GetJanitor(): Janitor<void>; | ||
Destroy(): void; | ||
private initProducer; | ||
@@ -22,3 +32,2 @@ /** @internal @hidden */ | ||
private subscribeToInitialState; | ||
Destroy(): void; | ||
} |
@@ -1,5 +0,5 @@ | ||
import { ClassProducer } from "../class-producer"; | ||
import { IClassProducer } from "../class-producer"; | ||
/** | ||
* Decorator for creating an Action inside a class producer. | ||
*/ | ||
export declare const Action: () => <S extends object, T extends ClassProducer<S>>(target: T, propertyKey: string, descriptor: TypedPropertyDescriptor<(this: T, ...args: unknown[]) => S>) => TypedPropertyDescriptor<(this: T, ...args: unknown[]) => S>; | ||
export declare const Action: () => <S extends object, T extends IClassProducer<S>>(target: T, propertyKey: string, descriptor: TypedPropertyDescriptor<(this: T, ...args: unknown[]) => S>) => TypedPropertyDescriptor<(this: T, ...args: unknown[]) => S>; |
@@ -1,2 +0,2 @@ | ||
import { ClassProducer, InferClassProducerState } from "../class-producer"; | ||
export declare const Subscribe: <T extends ClassProducer<InferClassProducerState<T>>, R>(selector: (state: InferClassProducerState<T>) => R, predicate?: ((state: R, previousState: R) => boolean) | undefined) => (target: T, propertyKey: string, descriptor: TypedPropertyDescriptor<(this: T, state?: R | undefined, previousState?: R | undefined) => void>) => void; | ||
import { IClassProducer, InferClassProducerState } from "../class-producer"; | ||
export declare const Subscribe: <T extends IClassProducer<InferClassProducerState<T>>, R>(selector: (state: InferClassProducerState<T>) => R, predicate?: ((state: R, previousState: R) => boolean) | undefined) => (target: T, propertyKey: string, descriptor: TypedPropertyDescriptor<(this: T, state?: R | undefined, previousState?: R | undefined) => void>) => void; |
{ | ||
"name": "@rbxts/reflex-class", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "out/init.lua", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17815
79