1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const _ = require("lodash");
|
4 |
|
5 |
|
6 |
|
7 | class Registry {
|
8 | constructor() {
|
9 | this.registry = new Map();
|
10 | }
|
11 | |
12 |
|
13 |
|
14 |
|
15 | addRegistry(subRegistry) {
|
16 | for (const [type, value] of subRegistry.registry) {
|
17 | this.get(type).push(...value);
|
18 | }
|
19 | }
|
20 | |
21 |
|
22 |
|
23 |
|
24 |
|
25 | get(type) {
|
26 | if (!this.registry.has(type)) {
|
27 | this.registry.set(type, []);
|
28 | }
|
29 | return this.registry.get(type);
|
30 | }
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 | add(type, target) {
|
37 | const values = this.get(type);
|
38 | if (!_.find(values, target)) {
|
39 | values.push(target);
|
40 | }
|
41 | }
|
42 | getAllAutoBind() {
|
43 | const autobinds = [];
|
44 | for (const [, values] of this.registry) {
|
45 | autobinds.push(...values.filter(v => v.autoBind));
|
46 | }
|
47 | return autobinds;
|
48 | }
|
49 | |
50 |
|
51 |
|
52 |
|
53 | remove(type) {
|
54 | this.registry.delete(type);
|
55 | }
|
56 | }
|
57 | exports.Registry = Registry;
|