UNPKG

magica

Version:

ImageMagick for browser and Node.js, easy setup, high level API and Command Line Interface, including WASM binary for an easy setup.

31 lines (30 loc) 1.22 kB
import { CommandPreprocessor, Options, RunOptions } from '../../types'; export interface TemplateHelper<O = any, R = any, RO = any, RR = any, CRO extends RunOptions = RunOptions> { name: string; fnCompileTime: (this: TemplateHelper & { options: CRO; }, options: O) => R; fnRunTime?: (options: RO) => RR; } export declare class Template implements CommandPreprocessor { protected templateOptions: { async: boolean; escape: (s: string) => string; rmWhitespace: boolean; }; protected templateRuntimeOptions: { delimiter: string; async: boolean; escape: (s: string) => string; rmWhitespace: boolean; }; constructor(); name: string; fnCompileTime(context: RunOptions): Promise<RunOptions>; fnRuntime(commandOptions: Options, commandIndex: number, runOptions: RunOptions): Promise<void>; } /** * Allows to change the context object on which templates are evaluated to add new properties or functions * so they can be evaluated in command templates. */ export declare function addTemplateHelper<O = any, R = any, RO = any, RR = any, CRO extends RunOptions = RunOptions>(h: TemplateHelper<O, R, RO, RR, CRO>): void;