Add TS part of RegisteredFunction API
This commit is contained in:
parent
9e92c21a2f
commit
7daec15a8e
|
|
@ -0,0 +1,12 @@
|
|||
const registeredFunctions = {};
|
||||
|
||||
// Code in Mono 'driver.c' looks for the registered functions here
|
||||
window['__blazorRegisteredFunctions'] = registeredFunctions;
|
||||
|
||||
export function registerFunction(identifier: string, implementation: Function) {
|
||||
if (registeredFunctions.hasOwnProperty(identifier)) {
|
||||
throw new Error(`A function with the identifier '${identifier}' has already been registered.`);
|
||||
}
|
||||
|
||||
registeredFunctions[identifier] = implementation;
|
||||
}
|
||||
Loading…
Reference in New Issue