@domql/state
Advanced tools
Comparing version 2.3.126 to 2.3.127
@@ -6,3 +6,3 @@ 'use strict' | ||
import { IGNORE_STATE_PARAMS } from './ignore' | ||
import { add, apply, clean, destroy, parse, remove, rootUpdate, set, toggle } from './methods' | ||
import { add, apply, clean, destroy, parentUpdate, parse, remove, rootUpdate, set, toggle } from './methods' | ||
import { updateState } from './updateState' | ||
@@ -82,2 +82,3 @@ import { checkIfInherits, createInheritedState } from './inherit' | ||
state.rootUpdate = rootUpdate | ||
state.parentUpdate = parentUpdate | ||
state.create = createState | ||
@@ -84,0 +85,0 @@ state.add = add |
@@ -90,2 +90,3 @@ "use strict"; | ||
state.rootUpdate = import_methods.rootUpdate; | ||
state.parentUpdate = import_methods.parentUpdate; | ||
state.create = createState; | ||
@@ -92,0 +93,0 @@ state.add = import_methods.add; |
@@ -36,2 +36,3 @@ "use strict"; | ||
"rootUpdate", | ||
"parentUpdate", | ||
"parent", | ||
@@ -38,0 +39,0 @@ "__element", |
@@ -25,2 +25,3 @@ "use strict"; | ||
destroy: () => destroy, | ||
parentUpdate: () => parentUpdate, | ||
parse: () => parse, | ||
@@ -85,2 +86,8 @@ remove: () => remove, | ||
}; | ||
const parentUpdate = function(obj, options = {}) { | ||
const state = this; | ||
if (!state || !state.parent) | ||
return; | ||
return state.parent.update(obj, { isHoisted: true, ...options }); | ||
}; | ||
const rootUpdate = function(obj, options = {}) { | ||
@@ -90,3 +97,2 @@ const state = this; | ||
return; | ||
console.log(options); | ||
const rootState = state.__element.__ref.__root.state; | ||
@@ -93,0 +99,0 @@ return rootState.update(obj, options); |
@@ -5,3 +5,3 @@ 'use strict' | ||
'update', 'parse', 'clean', 'create', 'destroy', 'add', 'toggle', 'remove', 'apply', 'set', | ||
'rootUpdate', 'parent', '__element', '__depends', '__ref', '__children', '__root' | ||
'rootUpdate', 'parentUpdate', 'parent', '__element', '__depends', '__ref', '__children', '__root' | ||
] |
@@ -65,6 +65,11 @@ 'use strict' | ||
export const parentUpdate = function (obj, options = {}) { | ||
const state = this | ||
if (!state || !state.parent) return | ||
return state.parent.update(obj, { isHoisted: true, ...options }) | ||
} | ||
export const rootUpdate = function (obj, options = {}) { | ||
const state = this | ||
if (!state) return | ||
console.log(options) | ||
const rootState = (state.__element.__ref.__root).state | ||
@@ -71,0 +76,0 @@ return rootState.update(obj, options) |
{ | ||
"name": "@domql/state", | ||
"version": "2.3.126", | ||
"version": "2.3.127", | ||
"license": "MIT", | ||
@@ -29,3 +29,3 @@ "type": "module", | ||
}, | ||
"gitHead": "6329de71d2e831d0efd9d59e765567aa8c563481" | ||
"gitHead": "8cefec8e0527a4cbd0ec964055435b00c28ec7c3" | ||
} |
34040
904