@expressive/mvc 0.21.3 → 0.21.7
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/index.d.ts +2 -2
- package/lib/index.esm.js +10 -6
- package/lib/index.js +10 -6
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ declare namespace Control {
|
|
|
71
71
|
*/
|
|
72
72
|
type OnReady<T extends Model> = (control: Control<T>) => Callback | void;
|
|
73
73
|
type RequestRefresh = (update: (tick: number) => number) => void;
|
|
74
|
-
type
|
|
74
|
+
type GetContext = (target: Model) => (callback: (got: Context) => void) => void;
|
|
75
75
|
type GetAdapter<T> = (refresh: RequestRefresh, context: Context) => {
|
|
76
76
|
mount: () => (() => void) | void;
|
|
77
77
|
render: () => T;
|
|
@@ -92,7 +92,7 @@ declare class Control<T extends Model = any> {
|
|
|
92
92
|
static pending: Set<Callback>;
|
|
93
93
|
static get: Control.GetHook;
|
|
94
94
|
static use: Control.UseHook;
|
|
95
|
-
static has: Control.
|
|
95
|
+
static has: Control.GetContext;
|
|
96
96
|
static for: typeof control;
|
|
97
97
|
static apply: typeof apply;
|
|
98
98
|
static watch: typeof watch;
|
package/lib/index.esm.js
CHANGED
|
@@ -659,12 +659,16 @@ function get(arg0, arg1) {
|
|
|
659
659
|
if (!hasParent) {
|
|
660
660
|
if (arg1 === true)
|
|
661
661
|
throw Oops$3.Required(arg0, subject);
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
662
|
+
const fetch = Control.has(subject);
|
|
663
|
+
source = got => {
|
|
664
|
+
fetch(context => {
|
|
665
|
+
const model = context.get(arg0);
|
|
666
|
+
if (model)
|
|
667
|
+
got(model);
|
|
668
|
+
else if (arg1 !== false)
|
|
669
|
+
throw Oops$3.AmbientRequired(arg0, subject);
|
|
670
|
+
});
|
|
671
|
+
};
|
|
668
672
|
}
|
|
669
673
|
else if (!arg0 || hasParent instanceof arg0)
|
|
670
674
|
subject = hasParent;
|
package/lib/index.js
CHANGED
|
@@ -663,12 +663,16 @@ function get(arg0, arg1) {
|
|
|
663
663
|
if (!hasParent) {
|
|
664
664
|
if (arg1 === true)
|
|
665
665
|
throw Oops$3.Required(arg0, subject);
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
666
|
+
const fetch = Control.has(subject);
|
|
667
|
+
source = got => {
|
|
668
|
+
fetch(context => {
|
|
669
|
+
const model = context.get(arg0);
|
|
670
|
+
if (model)
|
|
671
|
+
got(model);
|
|
672
|
+
else if (arg1 !== false)
|
|
673
|
+
throw Oops$3.AmbientRequired(arg0, subject);
|
|
674
|
+
});
|
|
675
|
+
};
|
|
672
676
|
}
|
|
673
677
|
else if (!arg0 || hasParent instanceof arg0)
|
|
674
678
|
subject = hasParent;
|
package/package.json
CHANGED