UNPKG

lazy-widgets

Version:

Typescript retained mode GUI for the HTML canvas API

77 lines (76 loc) 3.05 kB
/** * Check if a debug feature is enabled. * * @param debugFeature - The debug feature name, for example, "watchflag.Widget._layoutDirty" * @returns Returns true if the debug feature is enabled. If the feature doesn't exist or ins't enabled, returns false. * * @category Debug */ export declare function isDebugFeatureEnabled(debugFeature: string): boolean; /** * Enable or disable a debug feature. * * @param debugFeature - The debug feature name, for example, "watchflag.Widget._layoutDirty" * @param enabled - Should the feature be enabled or disabled? If undefined, toggles the feature * * @category Debug */ export declare function toggleDebugFeature(debugFeature: string, enabled?: boolean): void; /** * List all debug features in the console. * * @category Debug */ export declare function listDebugFeatures(): void; /** * Inject code for a new debug feature that watches when a class' property is * set to true and prints to the console. * * @param classObj - The class. Widget for example * @param flagKey - The key of the property to watch. "_layoutDirty" for example * * @category Debug */ export declare function injectWatchflagFeature(classObj: any, flagKey: string): void; /** * Inject code for a new debug feature that traces when a class' method is * called, if the class calls the same method for other objects (prints tree) * and how long each call took in milliseconds. * * @param classObj - The class. Widget for example * @param methodKey - The key of the property to watch. "paint" for example * @param messageGenerator - A function that returns a string with extra information about the function call. For example, a function which returns " (forced)" if Widget.paint is called with forced set to true * * @category Debug */ export declare function injectTraceFeature(classObj: any, methodKey: string, messageGenerator?: ((...args: any[]) => string) | null): void; /** * Inject code for a new debug feature that returns a random fill colour in a * given property when enabled. * * EPILEPSY WARNING: This debug feature may trigger epileptic seizures when * enabled, especially for widgets that frequently update. * * @param classObj - The class. BaseTheme for example * @param themePropertyKey - The key of the property to override. "canvasFill" for example * * @category Debug */ export declare function injectRandomFillFeature(classObj: any, themePropertyKey: string): void; /** * Inject code for a new debug feature that calls console.trace when a specific * method is called and this feature is enabled. * * @param classObj - The class. Widget for example * @param methodKey - The key of the property to watch. "paint" for example * * @category Debug */ export declare function injectStackTraceFeature(classObj: any, methodKey: string): void; /** * Inject all default debug code. Call this before doing anything if you want to * enable debugging. Has no effect when called more than once. * * @category Debug */ export declare function injectDebugCode(): void;