Files
wallet-web/src/core/utils/find-method.ts
2021-06-12 11:54:13 +02:00

16 lines
444 B
TypeScript

import { AppMainElement } from 'components/';
export default function findMethod(actionString: string, appMain: AppMainElement): Function {
if (actionString && appMain) {
const methodSep = actionString.lastIndexOf('#');
const tag = actionString.slice(0, methodSep);
const method = actionString.slice(methodSep + 1);
const element = appMain.querySelector(tag);
if (element) {
return element?.[method];
}
}
return () => {};
}