Skip to content

Commit

Permalink
Merge pull request #752 from ibrahemomari/fab-component-state
Browse files Browse the repository at this point in the history
convert State function to getter method
  • Loading branch information
bkalaldeh authored May 24, 2023
2 parents 9c2c6f8 + 26e9613 commit c95b5c1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions scripts/buildfire/components/fabSpeedDial/fabSpeedDial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ if (typeof buildfire == 'undefined')
throw 'please add buildfire.js first to use buildfire components';
if (typeof buildfire.components == 'undefined') buildfire.components = {};

function State() {
this.mainFabBtnElement = null;
this.isOpen = false;
this.overlayElement = null;
this.bodyTextColor = '#000000';
}


buildfire.components.fabSpeedDial = class FabSpeedDial {
constructor(selector, options = {}) {
if (!document.querySelector(selector)) throw new Error('Element not found!');
Expand All @@ -35,7 +27,13 @@ buildfire.components.fabSpeedDial = class FabSpeedDial {
}

this._onButtonClickCallbacks = [];
this._state = new State();
// initialize the state
this._state = {
mainFabBtnElement: null,
isOpen: false,
overlayElement: null,
bodyTextColor: '#000000',
};
this._onMainBtnClick = this._onMainBtnClick.bind(this);
this._onOverlayClick = this._onOverlayClick.bind(this);

Expand Down

0 comments on commit c95b5c1

Please sign in to comment.