Skip to content

Commit 9436e5f

Browse files
pdanpdanrstoenescu
authored andcommitted
close quasarframework#1913 - Return dismiss function from Notify.create (quasarframework#1915)
* close quasarframework#1913 - Return dismiss function from Notify.create close quasarframework#1913 * Update notify.js
1 parent 0d980f5 commit 9436e5f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/plugins/notify.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,27 @@ function init ({ $q, Vue }) {
166166

167167
export default {
168168
create (opts) {
169-
if (isSSR) { return }
169+
if (isSSR) { return () => {} }
170170

171171
if (!document.body) {
172+
let
173+
cancelled = false,
174+
cancelFn = () => {},
175+
cancelFnWrapper = () => {
176+
cancelled = true
177+
cancelFn()
178+
}
179+
172180
ready(() => {
173-
this.create(opts)
181+
if (!cancelled) {
182+
cancelFn = this.create(opts)
183+
}
174184
})
185+
186+
return cancelFnWrapper
175187
}
176-
else {
177-
this.__vm.add(opts)
178-
}
188+
189+
return this.__vm.add(opts)
179190
},
180191
setDefaults (opts) {
181192
Object.assign(defaults, opts)

0 commit comments

Comments
 (0)