Skip to content

Commit

Permalink
fix: drop legacy hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed May 19, 2021
1 parent b4b94d5 commit a736204
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- name: Install npm dependencies
run: yarn install
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export default function withReactContent (ParentSwal) {

let domElement

const openHookName = params.onOpen || !ParentSwal.isValidParameter('didOpen') ? 'onOpen' : 'didOpen' // support legacy onOpen hook
const openHookName = 'didOpen'
const superOpenHook = params[openHookName] || noop
params[openHookName] = (element) => {
domElement = getter(ParentSwal)
domElement && ReactDOM.render(reactElement, domElement)
superOpenHook(element)
}

const destroyHookName = params.onDestroy || !ParentSwal.isValidParameter('didDestroy') ? 'onDestroy' : 'didDestroy' // support legacy onDestroy hook
const destroyHookName = 'didDestroy'
const superDestroyHook = params[destroyHookName] || noop
params[destroyHookName] = (element) => {
superDestroyHook(element)
Expand Down

0 comments on commit a736204

Please sign in to comment.