surrogate
Version:
Object method hooks made easy
69 lines (61 loc) • 3.85 kB
JavaScript
import {determineWhich as $5a2a6178abf8fddd$export$8eec127a839d06d3, manageDecorator as $5a2a6178abf8fddd$export$50613b79e775cc76} from "./surrogate.5a994c10.js";
import {MethodWrapper as $66c0dea2f60cbf63$export$9255060c057a2446} from "./surrogate.a243fd60.js";
import {POST as $96586206eab52612$export$484f3009c2ee32ad, PRE as $96586206eab52612$export$4b15a4ac90c78f2b} from "./surrogate.5d082a84.js";
import {asArray as $8yW40$asArray} from "@jfrazx/asarray";
const $a8db9552d7b5e961$export$eedf49b4b69a5ead = (nextOptions)=>(target, event)=>(0, $8yW40$asArray)(nextOptions).forEach((nextOption)=>{
const { type: type, action: action, options: options = {} } = nextOption;
const which = (0, $5a2a6178abf8fddd$export$8eec127a839d06d3)(type);
const actions = (0, $8yW40$asArray)(action);
which.forEach((type)=>actions.forEach((action)=>(0, $5a2a6178abf8fddd$export$50613b79e775cc76)(type, {
handler: event,
options: options
})(target, action)));
});
const $a8db9552d7b5e961$export$b39ca5382585ee21 = (nextOptions)=>{
return $a8db9552d7b5e961$var$nextAsyncHelper(nextOptions, (0, $96586206eab52612$export$4b15a4ac90c78f2b));
};
const $a8db9552d7b5e961$export$dd29c1f31c33eedb = (nextOptions)=>{
return $a8db9552d7b5e961$var$nextAsyncHelper(nextOptions, (0, $96586206eab52612$export$484f3009c2ee32ad));
};
const $a8db9552d7b5e961$export$e8c7dd766f8d180a = (nextOptions)=>{
const which = [
(0, $96586206eab52612$export$4b15a4ac90c78f2b),
(0, $96586206eab52612$export$484f3009c2ee32ad)
];
return (target, event, descriptor)=>{
which.forEach((type)=>$a8db9552d7b5e961$var$nextAsyncHelper(nextOptions, type)(target, event, descriptor));
};
};
const $a8db9552d7b5e961$var$nextAsyncHelper = (nextOptions, type)=>{
return (target, event, descriptor)=>(0, $8yW40$asArray)(nextOptions).forEach(({ action: action, options: options })=>$a8db9552d7b5e961$var$nextHelper({
action: action,
options: {
...options,
wrapper: (0, $66c0dea2f60cbf63$export$9255060c057a2446).Async
}
}, type)(target, event, descriptor));
};
const $a8db9552d7b5e961$export$1e4ceaa741849ed7 = (nextOptions)=>{
return $a8db9552d7b5e961$var$nextHelper(nextOptions, (0, $96586206eab52612$export$4b15a4ac90c78f2b));
};
const $a8db9552d7b5e961$export$d40ee6255ee433dd = (nextOptions)=>{
return $a8db9552d7b5e961$var$nextHelper(nextOptions, (0, $96586206eab52612$export$484f3009c2ee32ad));
};
const $a8db9552d7b5e961$export$c11bc0137fa2c80f = (nextOptions)=>{
const which = [
(0, $96586206eab52612$export$4b15a4ac90c78f2b),
(0, $96586206eab52612$export$484f3009c2ee32ad)
];
return (target, event, descriptor)=>{
which.forEach((type)=>$a8db9552d7b5e961$var$nextHelper(nextOptions, type)(target, event, descriptor));
};
};
const $a8db9552d7b5e961$var$nextHelper = (hookOptions, type)=>{
return (target, event, descriptor)=>(0, $8yW40$asArray)(hookOptions).forEach(({ action: action, options: options = {} })=>$a8db9552d7b5e961$export$eedf49b4b69a5ead({
action: action,
type: type,
options: options
})(target, event, descriptor));
};
export {$a8db9552d7b5e961$export$eedf49b4b69a5ead as NextFor, $a8db9552d7b5e961$export$b39ca5382585ee21 as NextAsyncPre, $a8db9552d7b5e961$export$dd29c1f31c33eedb as NextAsyncPost, $a8db9552d7b5e961$export$e8c7dd766f8d180a as NextAsyncPreAndPost, $a8db9552d7b5e961$export$1e4ceaa741849ed7 as NextPre, $a8db9552d7b5e961$export$d40ee6255ee433dd as NextPost, $a8db9552d7b5e961$export$c11bc0137fa2c80f as NextPreAndPost};
//# sourceMappingURL=surrogate.da7139b1.js.map