Skip to content
This repository was archived by the owner on Dec 25, 2017. It is now read-only.

Commit 974cf61

Browse files
committed
⚡ improvement(async): update async validator for function I/F
1 parent 87b5b42 commit 974cf61

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

src/validations/base.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -421,24 +421,11 @@ export default class BaseValidation {
421421
_invokeValidator (vm, validator, val, arg, cb) {
422422
let future = validator.call(this, val, arg)
423423
if (typeof future === 'function') { // function
424-
if (future.resolved) {
425-
// cached
426-
cb(future.resolved)
427-
} else if (future.requested) {
428-
// pool callbacks
429-
future.pendingCallbacks.push(cb)
430-
} else {
431-
future.requested = true
432-
let cbs = future.pendingCallbacks = [cb]
433-
future(() => { // resolve
434-
future.resolved = true
435-
for (let i = 0, l = cbs.length; i < l; i++) {
436-
cbs[i](true)
437-
}
438-
}, (msg) => { // reject
439-
cb(false, msg)
440-
})
441-
}
424+
future(() => { // resolve
425+
cb(true)
426+
}, (msg) => { // reject
427+
cb(false, msg)
428+
})
442429
} else if (isPromise(future)) { // promise
443430
future.then(() => { // resolve
444431
cb(true)

0 commit comments

Comments
 (0)