Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x | import { ConcurrentMerger } from './concurrent-merger';
export default function concurrentMerger({
queueMaxLength,
name,
}: {
queueMaxLength?: typeof ConcurrentMerger.prototype.queueMaxLength;
name?: typeof ConcurrentMerger.prototype.name;
} = {}) {
const concurrentMerger = new ConcurrentMerger({ queueMaxLength, name });
return function (
_target: Record<string, any>,
_propertyName: string,
descriptor: TypedPropertyDescriptor<(...args: any[]) => any>
) {
const method = descriptor.value;
if (method)
// async 包一层,兼容 method 非异步函数情况
descriptor.value = concurrentMerger.proxy(async function (
this: any,
...arg
) {
return method.apply(this, arg);
});
};
}
|