@makano/rew 1.2.71 → 1.2.72

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makano/rew",
3
- "version": "1.2.71",
3
+ "version": "1.2.72",
4
4
  "description": "A simple coffescript runtime and app manager",
5
5
  "main": "main.js",
6
6
  "directories": {
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;