@alexgyver/component 1.0.8 → 1.0.10
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/component.js +2 -0
- package/package.json +1 -1
package/component.js
CHANGED
|
@@ -77,6 +77,7 @@ export class Component {
|
|
|
77
77
|
html {string} добавить в innerHTML
|
|
78
78
|
class {string} добавить в className
|
|
79
79
|
also {function} - вызвать с текущим компонентом: { ... , also(el) { console.log(el); }, }
|
|
80
|
+
export {} - присвоить к указанной переменной
|
|
80
81
|
var {string} создаёт переменную $имя в указанном контексте
|
|
81
82
|
events {object} добавляет addEventListener'ы {event: handler}
|
|
82
83
|
parent - {Element} добавляет компонент к указанному элементу (имеет смысл только для корневого компонента)
|
|
@@ -108,6 +109,7 @@ export class Component {
|
|
|
108
109
|
case 'html': $el.innerHTML = val; break;
|
|
109
110
|
case 'class': $el.className = val; break;
|
|
110
111
|
case 'also': if (context) val.call(context, $el); break;
|
|
112
|
+
case 'export': val = $el; break;
|
|
111
113
|
case 'var': if (context) context['$' + val] = $el; break;
|
|
112
114
|
case 'events': for (const [ev, handler] of Object.entries(val)) if (handler) $el.addEventListener(ev, handler.bind(context)); break;
|
|
113
115
|
case 'parent': if (val instanceof Element) val.append($el); break;
|