j-templates 7.0.34 → 7.0.36

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/Node/vNode.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.vNode = void 0;
4
4
  const Store_1 = require("../Store");
5
+ const functions_1 = require("../Utils/functions");
5
6
  const injector_1 = require("../Utils/injector");
6
7
  const list_1 = require("../Utils/list");
7
8
  const thread_1 = require("../Utils/thread");
@@ -152,8 +153,10 @@ function Children(vnode, children, data) {
152
153
  function CreateChildrenScope(vnode, children, data) {
153
154
  if (data === undefined)
154
155
  return Store_1.ObservableScope.Create(WrapStaticChildren(vnode, children));
156
+ const dataIsAsync = (0, functions_1.IsAsync)(data);
155
157
  const nodeList = list_1.List.Create();
156
158
  const scope = Store_1.ObservableScope.Create(WrapChildren(vnode.injector, children, ToArray(data), nodeList));
159
+ scope.async = dataIsAsync;
157
160
  Store_1.ObservableScope.OnDestroyed(scope, function () {
158
161
  DestroyNodeList(nodeList);
159
162
  });
@@ -167,6 +170,7 @@ function WrapStaticChildren(vnode, children) {
167
170
  };
168
171
  }
169
172
  function WrapChildren(injector, children, data, nodeList) {
173
+ const dataIsAsync = (0, functions_1.IsAsync)(data);
170
174
  return function () {
171
175
  const nextData = data();
172
176
  switch (nextData.length) {
@@ -194,6 +198,7 @@ function WrapChildren(injector, children, data, nodeList) {
194
198
  const childNodes = injector_1.Injector.Scope(injector, children, data);
195
199
  return CreateNodeArray(childNodes);
196
200
  });
201
+ childrenScope.async = dataIsAsync;
197
202
  list_1.List.Add(nextNodeList, {
198
203
  data,
199
204
  nodes: Store_1.ObservableScope.Value(childrenScope),
@@ -5,6 +5,7 @@ exports.CalcScope = CalcScope;
5
5
  const array_1 = require("../../Utils/array");
6
6
  const distinctArray_1 = require("../../Utils/distinctArray");
7
7
  const emitter_1 = require("../../Utils/emitter");
8
+ const functions_1 = require("../../Utils/functions");
8
9
  class ObservableScopeValue {
9
10
  get Value() {
10
11
  return ObservableScope.Value(this.scope);
@@ -74,7 +75,7 @@ function CalcScope(callback) {
74
75
  getFunction: valueFunction,
75
76
  value: null,
76
77
  promise: null,
77
- async: valueFunction[Symbol.toStringTag] === "AsyncFunction",
78
+ async: (0, functions_1.IsAsync)(valueFunction),
78
79
  dirty: true,
79
80
  emitter: emitter_1.Emitter.Create(),
80
81
  emitters: null,
@@ -0,0 +1 @@
1
+ export declare function IsAsync(func: Function): boolean;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsAsync = IsAsync;
4
+ function IsAsync(func) {
5
+ return func[Symbol.toStringTag] === "AsyncFunction";
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "7.0.34",
3
+ "version": "7.0.36",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",