$
This commit is contained in:
27
node_modules/riot/esm/core/create-attribute-bindings.js
generated
vendored
Normal file
27
node_modules/riot/esm/core/create-attribute-bindings.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/* Riot WIP, @license MIT */
|
||||
import { createCoreAPIMethods } from './create-core-api-methods.js';
|
||||
import { createExpression } from '@riotjs/dom-bindings';
|
||||
|
||||
/**
|
||||
* Create the bindings to update the component attributes
|
||||
* @param {HTMLElement} node - node where we will bind the expressions
|
||||
* @param {Array} attributes - list of attribute bindings
|
||||
* @returns {TemplateChunk} - template bindings object
|
||||
*/
|
||||
|
||||
function createAttributeBindings(node, attributes) {
|
||||
if (attributes === void 0) {
|
||||
attributes = [];
|
||||
}
|
||||
|
||||
const expressions = attributes.map(a => createExpression(node, a));
|
||||
const binding = {};
|
||||
return Object.assign(binding, Object.assign({
|
||||
expressions
|
||||
}, createCoreAPIMethods(method => scope => {
|
||||
expressions.forEach(e => e[method](scope));
|
||||
return binding;
|
||||
})));
|
||||
}
|
||||
|
||||
export { createAttributeBindings };
|
Reference in New Issue
Block a user