Skip to content

Commit

Permalink
feat(menu): add opened/closed events
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin B authored and adamdbradley committed May 20, 2016
1 parent f18a624 commit 51ee8b7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/menu/menu.ts
Expand Up @@ -285,6 +285,16 @@ export class Menu extends Ion {
*/
@Output() opening: EventEmitter<number> = new EventEmitter();

/**
* @output {event} When the menu has been opened.
*/
@Output() opened: EventEmitter<boolean> = new EventEmitter();

/**
* @output {event} When the menu has been closed.
*/
@Output() closed: EventEmitter<boolean> = new EventEmitter();

constructor(
private _menuCtrl: MenuController,
private _elementRef: ElementRef,
Expand Down Expand Up @@ -468,6 +478,7 @@ export class Menu extends Ion {
// keep opening/closing the menu disabled for a touch more yet
// only add listeners/css if it's enabled and isOpen
// and only remove listeners/css if it's not open
// emit opened/closed events
if ((this._isEnabled && isOpen) || !isOpen) {
this._prevent();

Expand All @@ -479,10 +490,12 @@ export class Menu extends Ion {

if (isOpen) {
this._cntEle.addEventListener('click', this.onContentClick);
this.opened.emit(true);

} else {
this.getNativeElement().classList.remove('show-menu');
this.getBackdropElement().classList.remove('show-backdrop');
this.closed.emit(true);
}
}
}
Expand Down

0 comments on commit 51ee8b7

Please sign in to comment.