be-hive 0.0.2 → 0.0.3
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/README.md +2 -16
- package/be-hive.js +2 -0
- package/be-hive.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,21 +28,7 @@ if(beHive !== null){
|
|
|
28
28
|
}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
be-hive then determines which be-hiviors to inherit
|
|
31
|
+
be-hive then determines which be-hiviors to inherit.
|
|
32
32
|
|
|
33
|
-
```JavaScript
|
|
34
|
-
const rn = beHiveInstance.getRootNode();
|
|
35
|
-
const parentShadowRealm = rn.host ? rn.host.getRootNode() : rn;
|
|
36
|
-
const parentBeHiveInstance = parentShadowRealm.querySelector('be-hive');
|
|
37
|
-
if(parentBeHiveInstance !== null){
|
|
38
|
-
parentBeHiveInstance.registeredBehaviors.forEach(behavior => {
|
|
39
|
-
beHiveInstance.register(behavior);
|
|
40
|
-
});
|
|
41
|
-
parentBeHiveInstance.addEventEventListener('latest-behavior-changed', e => {
|
|
42
|
-
beHiveInstance.register(e.detail.value);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
```
|
|
47
33
|
|
|
48
|
-
However, be-hive supports a "overrides" attribute/property that allows overriding the parent inheritance
|
|
34
|
+
However, be-hive supports a "overrides" attribute/property that allows overriding the parent inheritance.
|
package/be-hive.js
CHANGED
|
@@ -29,6 +29,8 @@ export class BeHiveCore extends HTMLElement {
|
|
|
29
29
|
return;
|
|
30
30
|
this.registeredBehaviors[localName] = instance;
|
|
31
31
|
const newBehaviorEl = document.createElement(localName);
|
|
32
|
+
newBehaviorEl.setAttribute('if-wants-to-be', instance.ifWantsToBe);
|
|
33
|
+
newBehaviorEl.setAttribute('upgrade', instance.upgrade);
|
|
32
34
|
this.appendChild(newBehaviorEl);
|
|
33
35
|
this.latestBehavior = instance;
|
|
34
36
|
}
|
package/be-hive.ts
CHANGED
|
@@ -32,6 +32,8 @@ export class BeHiveCore extends HTMLElement implements BeHiveActions{
|
|
|
32
32
|
if(this.overrides[instance.localName] !== undefined) return;
|
|
33
33
|
this.registeredBehaviors[localName] = instance;
|
|
34
34
|
const newBehaviorEl = document.createElement(localName);
|
|
35
|
+
newBehaviorEl.setAttribute('if-wants-to-be', instance.ifWantsToBe);
|
|
36
|
+
newBehaviorEl.setAttribute('upgrade', instance.upgrade);
|
|
35
37
|
this.appendChild(newBehaviorEl);
|
|
36
38
|
this.latestBehavior = instance;
|
|
37
39
|
|