/** * */ import { ChangeOperation, EventHook, ObjKey, PartialGraph, RecordedRead } from "./common"; import { WatchedProxyHandler } from "./watchedProxyFacade"; export declare abstract class ProxyFacade> extends PartialGraph { /** * Treats them like functions, meaning, they get a proxied 'this'. WatchProxies will see the access to the real properties */ propertyAccessorsAsWhiteBox: boolean; trackGetterCalls: boolean; protected objectsToProxyHandlers: WeakMap; /** * For react-deepwatch's binding function. Only, when trackGetterCalls is enabled */ currentOutermostGetter?: GetterCall; debug_id: number; protected abstract crateHandler(target: object, facade: any): HANDLER; getProxyFor(value: O): O; /** * * @param value * @return the original non-proxied- (by exactly this facade) value */ getUnproxiedValue(value: O): O; getHandlerFor(obj: object): HANDLER; } export declare abstract class FacadeProxyHandler> implements ProxyHandler { target: object; proxy: object; facade: FACADE; constructor(target: object, facade: FACADE); deleteProperty(target: object, key: string | symbol): boolean; defineProperty(target: object, property: string | symbol, attributes: PropertyDescriptor): boolean; get(fake_target: object, p: string | symbol, receiver: any): any; protected rawRead(key: ObjKey): unknown; set(fake_target: object, p: string | symbol, value: any, receiver: any): boolean; protected rawChange(p: string | symbol, newUnproxiedValue: any): void; } export declare function isProxyForAFacade(obj: object): boolean; /** * Makes the obj throw an error when trying to access it * @param obj * @param message * @param cause */ export declare function invalidateObject(obj: object, message: string, cause?: Error): void; /** * @returns the real real origial object from the real world */ export declare function getGlobalOrig(obj: T): T; export declare abstract class RecordedReadOnProxiedObject extends RecordedRead { proxyHandler: WatchedProxyHandler; /** * A bit redundant with proxyhandler. But for performance reasons, we leave it */ origObj: object; get proxy(): object; } export interface IWatchedProxyHandler_common { /** * Registers the Read to this WatchedProxyHandler and fires it on the WatchedFacade (informs WatchedFacade's listeners) * @param read */ fireAfterRead(read: RecordedReadOnProxiedObject): void; getFacade(): ProxyFacade; } /** * For use in proxy and direct */ export interface DualUseTracker { /** * Will return the handler when called through the handler */ get _watchedProxyHandler(): IWatchedProxyHandler_common | undefined; /** * The original (unproxied) object */ get _target(): T; } export declare function dualUseTracker_callOrigMethodOnTarget(tracker: DualUseTracker, methodName: M, args: unknown[]): any; /** * Informs hooksToServe's beforeListeners + executes changeOperation + informs hooksToServe's afterListeners. * All this while preventing listeners from beeing called twice (this is the main purpose of this function!). Even during the same operation (call) that spans a call stack (the stack can go through multiple proxy layers) *

* This function is needed, because there's some overlapping of concerns in listener types, especially for Arrays. Also internal methods may again call the set method which itsself wants to call the propertychange_listeners. *

* @param forTarget object to sync on. All hooks passed to nested runChangeOperation calls will only be fired once. * @param paramForListeners the parameter for the change listeners. It won't be run by this function / it's just the parameter. When setting to undefined, it indicates that this runChangeOperation call is only to wrap multiple nested calls / sync them on targetObject. The default anyChange hook won't be called at this level either. * @param hooksToServe these hooks will be called (not twice, as mentioned). * @param changeOperationFn */ export declare function runChangeOperation(forTarget: object, paramForListeners: ChangeOperation | undefined, hooksToServe: EventHook[], changeOperationFn: () => R): R; export interface ForWatchedProxyHandler extends DualUseTracker { /** * Will return the handler when called through the handler */ get _watchedProxyHandler(): IWatchedProxyHandler_common; /** * The original (unproxied) object */ get _target(): T; } /** * Use this to delete properties on objects that have a write tracker installed. Otherwise they are not deletable and the write tracker cannot track the object's keys modification and inform listeners * @param obj * @param key */ export declare function deleteProperty(obj: O, key: keyof O): boolean; export declare class GetterCall { proxy: object; key: ObjKey; constructor(proxy: object, key: ObjKey); } export declare const changeTrackedOrigObjects: PartialGraph; //# sourceMappingURL=proxyFacade.d.ts.map