You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
855 B
21 lines
855 B
/**
|
|
* Retrieves and returns an action from the client (if exists), and falls
|
|
* back to the tree-shakable action.
|
|
*
|
|
* Useful for extracting overridden actions from a client (ie. if a consumer
|
|
* wants to override the `sendTransaction` implementation).
|
|
*/
|
|
export function getAction(client, actionFn,
|
|
// Some minifiers drop `Function.prototype.name`, or replace it with short letters,
|
|
// meaning that `actionFn.name` will not always work. For that case, the consumer
|
|
// needs to pass the name explicitly.
|
|
name) {
|
|
const action_implicit = client[actionFn.name];
|
|
if (typeof action_implicit === 'function')
|
|
return action_implicit;
|
|
const action_explicit = client[name];
|
|
if (typeof action_explicit === 'function')
|
|
return action_explicit;
|
|
return (params) => actionFn(client, params);
|
|
}
|
|
//# sourceMappingURL=getAction.js.map
|