UNPKG

@odoo/o-spreadsheet

Version:
22 lines (21 loc) 1.23 kB
import { CoreCommand, CoreCommandTypes } from "../types/commands"; import { Registry } from "./registry"; export type TransformationFunction<U extends CoreCommandTypes, V extends CoreCommandTypes> = (toTransform: Extract<CoreCommand, { type: U; }>, executed: Extract<CoreCommand, { type: V; }>) => CoreCommand | undefined; export declare class OTRegistry extends Registry<Map<CoreCommandTypes, TransformationFunction<CoreCommandTypes, CoreCommandTypes>>> { /** * Add a transformation function to the registry. When the executed command * happened, all the commands in toTransforms should be transformed using the * transformation function given */ addTransformation<U extends CoreCommandTypes, V extends CoreCommandTypes>(executed: U, toTransforms: V[], fn: TransformationFunction<CoreCommandTypes, CoreCommandTypes>): this; /** * Get the transformation function to transform the command toTransform, after * that the executed command happened. */ getTransformation<U extends CoreCommandTypes, V extends CoreCommandTypes>(toTransform: U, executed: V): TransformationFunction<CoreCommandTypes, CoreCommandTypes> | undefined; } export declare const otRegistry: OTRegistry;