1 | import Adjust from './adjusts/adjust';
|
2 | var ADJUST_MAP = {};
|
3 | /**
|
4 | * 根据类型获取 Adjust 类
|
5 | * @param type
|
6 | */
|
7 | var getAdjust = function (type) {
|
8 | return ADJUST_MAP[type.toLowerCase()];
|
9 | };
|
10 | /**
|
11 | * 注册自定义 Adjust
|
12 | * @param type
|
13 | * @param ctor
|
14 | */
|
15 | var registerAdjust = function (type, ctor) {
|
16 | // 注册的时候,需要校验 type 重名,不区分大小写
|
17 | if (getAdjust(type)) {
|
18 | throw new Error("Adjust type '" + type + "' existed.");
|
19 | }
|
20 | // 存储到 map 中
|
21 | ADJUST_MAP[type.toLowerCase()] = ctor;
|
22 | };
|
23 | export { getAdjust, registerAdjust, Adjust };
|
24 | export * from './interface';
|
25 | //# sourceMappingURL=factory.js.map |
\ | No newline at end of file |