figureone
    Preparing search index...

    Class FunctionMap

    Function Map

    In FigureOne Recorder, state is saved in stringified javascript objects. When the state includes a function (like a trigger method in an animation for example) then that function is referenced in the state object as a unique string id.

    When a geometry is loaded, functions that will be captured in state objects need to be added to a function map. Both Figure and FigureElement have attached function maps as the property fnMap. Therefore, the method is added to either the figure or element function map, with an associated unique string id, and that string id is used when the function is used. For example as defined callbacks, triggerAnimationStep and customAnimationStep callbacks, or recorder slide definitions (entryState, steadyState, leaveState, exec, execDelta).

    The funciton map has:

    • A map of functions
    • A link to a global map of functions (a singleton)
    • The ability to execute a function within the map
    // Add a console function to a FunctionMap and execute it with a parameter
    figure.fnMap.add('toConsole', s => console.log(s));
    figure.fnMap.exec('toConsole', 'hello');

    Hierarchy

    • GeneralFunctionMap
      • FunctionMap
    Index

    Methods

    Methods

    • Execute function with arguments.

      Parameters

      • idOrFn: string | Function | null

        If string, then a function in the local map or global map will be executed (local map takes precedence). If Function, then the function will be exectuted. If null, then nothing will happen.

      • ...args: any[]

      Returns any