-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: separate event setting from button creation
Fixes the bug of not setting events on a button because the button is not yet created or appended to the DOM. Event setting relies on the element's ID in the DOM. Separated event setting into another method to address this issue. Additionally, return `this` in methods where chaining is necessary.
- Loading branch information
1 parent
794bc87
commit b312723
Showing
3 changed files
with
22 additions
and
26 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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict' | ||
|
||
import { isConfigVerified } from '@utilities/config/config-verifier' | ||
import { setEvents } from '@utilities/components/set-events' | ||
|
||
function setButtonEvents(config) { | ||
if (!isConfigVerified('button', config)) return | ||
const { id, events } = config | ||
setEvents(id, events) | ||
} | ||
|
||
export { setButtonEvents } |
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