bindExternalFunction method
Register an external function in script there must be a declaraction also in script for using this the function here can be either a pure dart function or a HTExternalFunction we use a conventions to distinguish different types of functions here:
- for toplevel external functions, use id like '$functionId'
- for static method or contructor of a class, use id like '$classId.$functionId'
- for external functions within a explicity declared namespace, use id like '$namespaceId::$functionId'
Implementation
void bindExternalFunction(String id, Function function,
{bool override = true}) {
if (externalFunctions.containsKey(id) && !override) {
throw HTError.defined(id, HTErrorType.runtimeError);
}
externalFunctions[id] = function;
}