mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
24 lines
627 B
JavaScript
24 lines
627 B
JavaScript
/**
|
|
* Set an alpine.js property
|
|
*
|
|
* @function setProp
|
|
* @param {string} key - Key of the data property
|
|
* @param {*} prop - The data property
|
|
* @param {string} selector - The jQuery selector to the root element
|
|
*/
|
|
const setProp = (key, prop, selector = '#root') => {
|
|
$(selector).get(0).__x.$data[key] = prop;
|
|
};
|
|
|
|
/**
|
|
* Get an alpine.js property
|
|
*
|
|
* @function getProp
|
|
* @param {string} key - Key of the data property
|
|
* @param {string} selector - The jQuery selector to the root element
|
|
* @return {*} The data property
|
|
*/
|
|
const getProp = (key, selector = '#root') => {
|
|
return $(selector).get(0).__x.$data[key];
|
|
};
|