@makano/rew 1.2.72 → 1.2.73

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.
@@ -28,6 +28,20 @@ module.exports.Usage = class Usage {
28
28
  create(name, trigger, save = true){
29
29
  return new Usage(name, trigger, save);
30
30
  }
31
+
32
+ group(group, props){
33
+ return new Usage.Group(group, props);
34
+ }
35
+
36
+ static Group = class UsageGroup {
37
+ g = [{}, () => {}]
38
+ constructor(g, props){
39
+ this.g = g;
40
+ for(let i in props){
41
+ this[i] = props[i];
42
+ }
43
+ }
44
+ }
31
45
  }
32
46
 
33
47
  class Namespace extends module.exports.Usage {
@@ -43,15 +57,7 @@ class Namespace extends module.exports.Usage {
43
57
  this.namespace = ns;
44
58
  }
45
59
 
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
- }
60
+ static Group = class NamespaceGroup extends module.exports.Usage.Group {}
55
61
  }
56
62
  module.exports.Namespace = Namespace;
57
63
 
@@ -106,6 +106,10 @@ module.exports.prepareContext = function (
106
106
  context.exports = exportsFunction(context);
107
107
 
108
108
  context.using = (name, ...params) => {
109
+ if(name instanceof Usage.Group){
110
+ params.unshift(name.g[1])
111
+ name = name.g[0];
112
+ }
109
113
  if(USING_DEFAULT[name]){
110
114
  if(USING_DEFAULT[name].param) {
111
115
  context.__using__[name] = USING_DEFAULT[name].param(...params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makano/rew",
3
- "version": "1.2.72",
3
+ "version": "1.2.73",
4
4
  "description": "A simple coffescript runtime and app manager",
5
5
  "main": "main.js",
6
6
  "directories": {
package/runtime.d.ts CHANGED
@@ -944,7 +944,7 @@ declare function clear(): void;
944
944
 
945
945
  declare function namespace(object: any, callback: () => any): Usage;
946
946
  declare namespace namespace {
947
- function group<T = any[], U = any>(group: T, props?: U): { g: T }
947
+ function group<T = any[], U = any>(group: T, props?: U): { g: T, [key: string]: any }
948
948
  }
949
949
 
950
950
  declare class Usage<T = () => void> {
@@ -953,4 +953,5 @@ declare class Usage<T = () => void> {
953
953
  save: boolean;
954
954
  constructor(name: string, trigger: T, save: boolean);
955
955
  create(name: string, trigger: T, save: boolean): Usage;
956
+ group<T = any[], U = any>(group: T, props?: U): { g: T, [key: string]: any }
956
957
  }