@srfnstack/fntags 0.3.6 → 0.3.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/package.json +1 -1
- package/src/fntags.mjs +10 -0
package/package.json
CHANGED
package/src/fntags.mjs
CHANGED
|
@@ -169,6 +169,16 @@ export const fnstate = (initialValue, mapKey) => {
|
|
|
169
169
|
*/
|
|
170
170
|
ctx.state.bindAs = (element, update) => doBindAs(ctx, element ?? ctx.state, update)
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Bind a property of an object stored in this state as a simple value.
|
|
174
|
+
*
|
|
175
|
+
* Shortcut for `mystate.bindAs((current)=> current[prop])`
|
|
176
|
+
*
|
|
177
|
+
* @param {string} prop The object property to bind as
|
|
178
|
+
* @returns {(HTMLDivElement|Text)[]|HTMLDivElement|Text}
|
|
179
|
+
*/
|
|
180
|
+
ctx.state.bindProp = (prop) => doBindAs(ctx, (st) => st[prop])
|
|
181
|
+
|
|
172
182
|
/**
|
|
173
183
|
* Bind attribute values to state changes
|
|
174
184
|
* @param [attribute] A function that returns an attribute value. If not passed, defaults to the state's value
|