@makano/rew 1.2.71 → 1.2.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/rew/const/usage.js +17 -1
- package/package.json +1 -1
- package/runtime.d.ts +3 -0
package/lib/rew/const/usage.js
CHANGED
|
@@ -34,13 +34,29 @@ class Namespace extends module.exports.Usage {
|
|
|
34
34
|
namespace = {};
|
|
35
35
|
constructor(ns, cb){
|
|
36
36
|
super('namespace');
|
|
37
|
+
if(ns instanceof Namespace.Group){
|
|
38
|
+
cb = ns.g[1]
|
|
39
|
+
ns = ns.g[0]
|
|
40
|
+
}
|
|
37
41
|
this.save = false;
|
|
38
42
|
this.trigger = cb;
|
|
39
43
|
this.namespace = ns;
|
|
40
44
|
}
|
|
45
|
+
|
|
46
|
+
static Group = class NamespaceGroup {
|
|
47
|
+
g = [{}, () => {}]
|
|
48
|
+
constructor(g, props){
|
|
49
|
+
this.g = g;
|
|
50
|
+
for(let i in props){
|
|
51
|
+
this[i] = props[i];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
41
55
|
}
|
|
42
56
|
module.exports.Namespace = Namespace;
|
|
43
57
|
|
|
44
58
|
module.exports.namespace = (namespace, cb) => {
|
|
45
59
|
return new Namespace(namespace, cb);
|
|
46
|
-
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports.namespace.group = (group, props) => new Namespace.Group(group, props);
|
package/package.json
CHANGED
package/runtime.d.ts
CHANGED
|
@@ -943,6 +943,9 @@ declare function wait(fn: CallableFunction, ...args: any[]): any;
|
|
|
943
943
|
declare function clear(): void;
|
|
944
944
|
|
|
945
945
|
declare function namespace(object: any, callback: () => any): Usage;
|
|
946
|
+
declare namespace namespace {
|
|
947
|
+
function group<T = any[], U = any>(group: T, props?: U): { g: T }
|
|
948
|
+
}
|
|
946
949
|
|
|
947
950
|
declare class Usage<T = () => void> {
|
|
948
951
|
name: string;
|