@domql/state 2.5.187 → 2.5.193

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.
@@ -33,7 +33,7 @@ const STATE_UPDATE_OPTIONS = {
33
33
  isHoisted: true,
34
34
  execStateFunction: true
35
35
  };
36
- const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
36
+ const updateState = async function(obj, options = STATE_UPDATE_OPTIONS) {
37
37
  const state = this;
38
38
  const element = state.__element;
39
39
  if (options.onEach)
@@ -47,7 +47,7 @@ const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
47
47
  } else if (options.preventInheritAtCurrentState)
48
48
  return;
49
49
  if (!options.preventBeforeStateUpdateListener) {
50
- const beforeStateUpdateReturns = (0, import_event.triggerEventOnUpdate)("beforeStateUpdate", obj, element, options);
50
+ const beforeStateUpdateReturns = await (0, import_event.triggerEventOnUpdate)("beforeStateUpdate", obj, element, options);
51
51
  if (beforeStateUpdateReturns === false)
52
52
  return element;
53
53
  }
@@ -58,7 +58,7 @@ const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
58
58
  updateDependentState(state, obj, options);
59
59
  applyElementUpdate(state, obj, options);
60
60
  if (!options.preventStateUpdateListener) {
61
- (0, import_event.triggerEventOnUpdate)("stateUpdate", obj, element, options);
61
+ await (0, import_event.triggerEventOnUpdate)("stateUpdate", obj, element, options);
62
62
  }
63
63
  return state;
64
64
  };
@@ -29,7 +29,7 @@ const STATE_UPDATE_OPTIONS = {
29
29
  isHoisted: true,
30
30
  execStateFunction: true
31
31
  };
32
- const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
32
+ const updateState = async function(obj, options = STATE_UPDATE_OPTIONS) {
33
33
  const state = this;
34
34
  const element = state.__element;
35
35
  if (options.onEach)
@@ -43,7 +43,7 @@ const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
43
43
  } else if (options.preventInheritAtCurrentState)
44
44
  return;
45
45
  if (!options.preventBeforeStateUpdateListener) {
46
- const beforeStateUpdateReturns = triggerEventOnUpdate("beforeStateUpdate", obj, element, options);
46
+ const beforeStateUpdateReturns = await triggerEventOnUpdate("beforeStateUpdate", obj, element, options);
47
47
  if (beforeStateUpdateReturns === false)
48
48
  return element;
49
49
  }
@@ -54,7 +54,7 @@ const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
54
54
  updateDependentState(state, obj, options);
55
55
  applyElementUpdate(state, obj, options);
56
56
  if (!options.preventStateUpdateListener) {
57
- triggerEventOnUpdate("stateUpdate", obj, element, options);
57
+ await triggerEventOnUpdate("stateUpdate", obj, element, options);
58
58
  }
59
59
  return state;
60
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.187",
3
+ "version": "2.5.193",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -28,9 +28,9 @@
28
28
  "prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
29
29
  },
30
30
  "dependencies": {
31
- "@domql/event": "^2.5.187",
31
+ "@domql/event": "^2.5.190",
32
32
  "@domql/report": "^2.5.186",
33
33
  "@domql/utils": "^2.5.187"
34
34
  },
35
- "gitHead": "c150bfbbdd51b19d25c93f10334d54175cea9d1d"
35
+ "gitHead": "43f57cec4a807f104342f92da621aedcd0b48e3e"
36
36
  }
package/updateState.js CHANGED
@@ -14,7 +14,7 @@ const STATE_UPDATE_OPTIONS = {
14
14
  execStateFunction: true
15
15
  }
16
16
 
17
- export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
17
+ export const updateState = async function (obj, options = STATE_UPDATE_OPTIONS) {
18
18
  const state = this
19
19
  const element = state.__element
20
20
 
@@ -28,7 +28,7 @@ export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
28
28
  } else if (options.preventInheritAtCurrentState) return
29
29
 
30
30
  if (!options.preventBeforeStateUpdateListener) {
31
- const beforeStateUpdateReturns = triggerEventOnUpdate('beforeStateUpdate', obj, element, options)
31
+ const beforeStateUpdateReturns = await triggerEventOnUpdate('beforeStateUpdate', obj, element, options)
32
32
  if (beforeStateUpdateReturns === false) return element
33
33
  }
34
34
 
@@ -41,7 +41,7 @@ export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
41
41
  applyElementUpdate(state, obj, options)
42
42
 
43
43
  if (!options.preventStateUpdateListener) {
44
- triggerEventOnUpdate('stateUpdate', obj, element, options)
44
+ await triggerEventOnUpdate('stateUpdate', obj, element, options)
45
45
  }
46
46
 
47
47
  return state