| 741 | this.registrationCount[name]++; |
| 742 | |
| 743 | const Checker = (args) => { |
| 744 | let perm: bigint; |
| 745 | let priv: number; |
| 746 | let checker = () => { }; |
| 747 | for (const item of args) { |
| 748 | if (typeof item === 'object') { |
| 749 | if (typeof item.call !== 'undefined') { |
| 750 | checker = item; |
| 751 | } else if (typeof item[0] === 'number') { |
| 752 | priv = item; |
| 753 | } else if (typeof item[0] === 'bigint') { |
| 754 | perm = item; |
| 755 | } |
| 756 | } else if (typeof item === 'number') { |
| 757 | priv = item; |
| 758 | } else if (typeof item === 'bigint') { |
| 759 | perm = item; |
| 760 | } |
| 761 | } |
| 762 | return function check(this: Handler) { |
| 763 | checker(); |
| 764 | if (perm) this.checkPerm(perm); |
| 765 | if (priv) this.checkPriv(priv); |
| 766 | }; |
| 767 | }; |
| 768 | |
| 769 | // We hope to use parent context for handler (the context that calls register) |
| 770 | // So that handler can use services injected before calling register |