-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(uk-switcher): add uikit events for the switcher component
- Loading branch information
1 parent
a1e181b
commit 641bdaf
Showing
2 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
import Component from "@ember/component"; | ||
import layout from "../../../templates/components/uk-switcher/content/item"; | ||
import UIkit from "uikit"; | ||
|
||
// empty function as default event handler | ||
const noop = () => {}; | ||
|
||
export default Component.extend({ | ||
layout, | ||
|
||
tagName: "li" | ||
tagName: "li", | ||
|
||
setEvents() { | ||
let events = { | ||
beforeshow: this.getWithDefault("on-beforeshow", noop), | ||
show: this.getWithDefault("on-show", noop), | ||
shown: this.getWithDefault("on-shown", noop), | ||
beforehide: this.getWithDefault("on-beforehide", noop), | ||
hide: this.getWithDefault("on-hide", noop), | ||
hidden: this.getWithDefault("on-hidden", noop) | ||
}; | ||
|
||
for (let event in events) { | ||
UIkit.util.on(this.element, event, events[event]); | ||
} | ||
}, | ||
didInsertElement() { | ||
this._super(...arguments); | ||
this.setEvents(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters