MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / checkedNodeCall

Function checkedNodeCall

javascript/selenium-webdriver/lib/promise.js:49–59  ·  view source on GitHub ↗

* Wraps a function that expects a node-style callback as its final * argument. This callback expects two arguments: an error value (which will be * null if the call succeeded), and the success value as the second argument. * The callback will the resolve or reject the returned promise, based on i

(fn, ...args)

Source from the content-addressed store, hash-verified

47 * result of the provided function's callback.
48 */
49function checkedNodeCall(fn, ...args) {
50 return new Promise(function (fulfill, reject) {
51 try {
52 fn(...args, function (error, value) {
53 error ? reject(error) : fulfill(value)
54 })
55 } catch (ex) {
56 reject(ex)
57 }
58 })
59}
60
61/**
62 * Registers a listener to invoke when a promise is resolved, regardless

Callers

nothing calls this directly

Calls 2

fnFunction · 0.50
rejectFunction · 0.50

Tested by

no test coverage detected