Skip to content

Commit

Permalink
Cleanup StateResource
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschot committed Feb 24, 2025
1 parent 4dd0457 commit 25675e9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ember-mobile-menu/src/components/mobile-menu.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class StateResource {

@cached
get current() {
let [position, isDragging, width, onToggle] = this._useState();
let { position, isDragging, width, onToggle } = this._useState();

this._dragging = position !== 0 && isDragging;
let open = !this._dragging && Math.abs(position) === width;
Expand Down Expand Up @@ -120,12 +120,12 @@ class StateResource {
* @public
*/
export default class MobileMenu extends Component {
state = new StateResource(this, () => [
this.position,
this.args.isDragging,
this._width,
this.onToggle,
]);
state = new StateResource(this, () => ({
position: this.position,
isDragging: this.args.isDragging,
width: this._width,
onToggle: this.onToggle,
}));

/**
* The type of menu. Currently 'left' and 'right' are supported.
Expand Down

0 comments on commit 25675e9

Please sign in to comment.