Custom function registration
Applications can register their own functions with a name, an argument schema, an implementation, and flags for volatility and range handling. Custom functions run as plain host-side JavaScript that the developer provides; the formula text itself is never executed. Errors thrown by a custom function become #ERROR! instead of crashing the grid.
Planned. This page shows the specification from issue #192. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid that uses =TAXRATE(B2)*C2, with the TAXRATE function shown in an editable code panel. The code panel is a configuration preview only and is never evaluated from text.
Expected behavior
Registering the function makes the cells compute. Unregistering it turns them into #NAME?. Enabling the throw toggle shows #ERROR! with the message in the tooltip.
Planned API surface
method: formulaEngine.registerFunction(def)method: formulaEngine.unregisterFunction(name)type: CustomFunctionDef {name, params, fn, volatile, returnType, description}event: functionRegisteredAcceptance criteria
- A registered name becomes available immediately, and existing formulas that use it recalculate. (pending)
- Name collisions with built-ins are rejected unless override is true. (pending)
- Argument count and type validation follow the params schema and return #VALUE! on mismatch. (pending)
- Exceptions are caught and mapped to #ERROR!. (pending)
- Custom functions appear in the function picker with their descriptions. (pending)