@twobirds/microcomponents 0.0.29 → 0.0.30
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.
|
@@ -27,7 +27,9 @@ As an application programmer you should understand **MC** and **DC** methods and
|
|
|
27
27
|
- **DC** use observables and formValues to provide 1-way and 2-way binding to the DOM.
|
|
28
28
|
- **DC** have selectors to find other DCs in the DOM.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
# Not Exported
|
|
31
|
+
|
|
32
|
+
## McBase() Superclass
|
|
31
33
|
|
|
32
34
|
**Instance Properties**
|
|
33
35
|
- `.target`: readonly, a getter returning the DOM element or parent MC instance your instance resides in
|
|
@@ -101,6 +103,7 @@ MyPublicClass = class extends DC{
|
|
|
101
103
|
DC.add( myElement, 'myDcComponent', new MyClass( myElement ) );
|
|
102
104
|
```
|
|
103
105
|
|
|
106
|
+
#### **Hint**
|
|
104
107
|
- After you added a micro component using this function, the **HTMLElement will contain a property `_mc`** which contains the external MC instances.
|
|
105
108
|
- Also the **HTMLElement then has an attribute '_mc'** which will indicate that at least one micro component is attached to this dom element.
|
|
106
109
|
|
|
@@ -191,7 +194,7 @@ this
|
|
|
191
194
|
|
|
192
195
|
// trigger an event on your external siblings
|
|
193
196
|
DC
|
|
194
|
-
.trigger( this.target, 'myEvent', data); // calls the "onMyEvent" callback on all
|
|
197
|
+
.trigger( this.target, 'myEvent', data); // calls the "onMyEvent" callback on all external MCs that listen to it
|
|
195
198
|
|
|
196
199
|
// trigger an event on some remote DOM instance(s)
|
|
197
200
|
DC
|
|
@@ -222,7 +225,6 @@ Any methods you define in your code that start with **"on"** or **"one"**, and a
|
|
|
222
225
|
class MyEventTarget extends MC {
|
|
223
226
|
constructor(target) {
|
|
224
227
|
super(target);
|
|
225
|
-
this.autoAttachListeners();
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
onClick(ev) {
|
|
@@ -238,10 +240,12 @@ DC.add( myFirstDiv, 'myEventTarget', new MyEventTarget( myFirstDiv ) );
|
|
|
238
240
|
|
|
239
241
|
## Init
|
|
240
242
|
- "this" first
|
|
241
|
-
- traverses recursively into the _mc structure
|
|
243
|
+
- traverses recursively into the _mc structure.
|
|
244
|
+
- callbacks will be executed **asynchronous**.
|
|
242
245
|
- requires **method .oneInit()** to be present in your class definition.
|
|
243
246
|
|
|
244
247
|
## Destroy ( TBD )
|
|
245
|
-
-
|
|
248
|
+
- deepest nested elements first.
|
|
249
|
+
- callbacks will be executed **synchronous**.
|
|
246
250
|
- then "this"
|
|
247
251
|
- requires **method .oneDestroy()** to be present in your class definition.
|