Skip to content

Commit 41ad0b7

Browse files
committed
feat(this.rb.elms): provide namespace for storing component elements via this.rb.elms property
1 parent fe4ac1a commit 41ad0b7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ $ npm install @rapid-build-ui/rb-base
2424
* Callbacks:
2525
* viewReady()
2626
* Creates this.rb object that contains a set of common helper objects:
27+
* this.rb.elms
2728
* this.rb.events
2829
* this.rb.view
2930

@@ -40,8 +41,8 @@ export class RbPopover extends RbBase() {
4041
// Lifecycle
4142
viewReady() { // :void
4243
super.viewReady && super.viewReady(); // line required
43-
const trigger = this.shadowRoot.querySelector('.trigger');
44-
this.rb.events.add(trigger, 'click touchstart', this.toggle);
44+
this.rb.elms.trigger = this.shadowRoot.querySelector('.trigger');
45+
this.rb.events.add(this.rb.elms.trigger, 'click touchstart', this.toggle);
4546
}
4647
// Event Handler
4748
toggle(e) { // :void
@@ -118,6 +119,11 @@ to be used in view.
118119

119120
## API
120121

122+
### this.rb.elms
123+
*See "How To Use"*
124+
This is object/hashmap to store component elements.
125+
126+
121127
### this.rb.events
122128
* Properties
123129
* events :object (readonly, hashmap of active events)

src/client/scripts/rb-base.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const RbBase = (Base = HTMLElement) => class extends withComponent(Base) {
1414
constructor() { // :void
1515
super();
1616
this.rb = {
17+
elms: {},
1718
events: EventService.call(this),
1819
view: ViewService.call(this)
1920
}

0 commit comments

Comments
 (0)