speech_rule_functions.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. import { AuditoryDescription } from '../audio/auditory_description.js';
  2. import { Span } from '../audio/span.js';
  3. declare abstract class FunctionsStore<S> {
  4. private prefix;
  5. private store;
  6. protected constructor(prefix: string, store: {
  7. [key: string]: S;
  8. });
  9. add(name: string, func: S): void;
  10. addStore(store: FunctionsStore<S>): void;
  11. lookup(name: string): S;
  12. private checkCustomFunctionSyntax_;
  13. }
  14. export type CustomQuery = (p1: Element) => Element[];
  15. export declare class CustomQueries extends FunctionsStore<CustomQuery> {
  16. constructor();
  17. }
  18. export type CustomString = (p1: Element) => Span[];
  19. export declare class CustomStrings extends FunctionsStore<CustomString> {
  20. constructor();
  21. }
  22. export type ContextFunction = (p1: Element[] | Element, p2: string | null) => () => string | AuditoryDescription[];
  23. export declare class ContextFunctions extends FunctionsStore<ContextFunction> {
  24. constructor();
  25. }
  26. export type CustomGenerator = (store?: any, flag?: boolean) => string[] | void;
  27. export declare class CustomGenerators extends FunctionsStore<CustomGenerator> {
  28. constructor();
  29. }
  30. export type SpeechRuleFunction = CustomQuery | CustomString | ContextFunction | CustomGenerator;
  31. export {};