本文整理汇总了TypeScript中src/utils/Deferred.resolve函数的典型用法代码示例。如果您正苦于以下问题:TypeScript resolve函数的具体用法?TypeScript resolve怎么用?TypeScript resolve使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resolve函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
conn.stream.on('end', () => {
const result: ExecuteFluxQueryResult = {
csv,
didTruncate,
rowCount,
}
deferred.resolve(result)
})
示例2: countNewRows
const resolve = () => {
let csv = xhr.responseText
if (didTruncate) {
// Discard the last line in the response since it may be partially read
csv = csv.slice(0, csv.lastIndexOf('\n'))
}
rowCount += countNewRows()
const result: ExecuteFluxQueryResult = {
csv,
didTruncate,
rowCount,
}
deferred.resolve(result)
clearTimeout(interval)
}
示例3: async
const checkResult = async (
promise: Promise<V>,
deferred: Deferred,
promiseID: number
) => {
let result
let isOk = true
try {
result = await promise
} catch (error) {
result = error
isOk = false
}
if (promiseID !== id) {
deferred.reject(new CancellationError())
} else if (!isOk) {
deferred.reject(result)
} else {
deferred.resolve(result)
}
}
示例4:
Promise.all(findLeaves(graph).map(resolve)).then(() => {
deferred.resolve(extractResult(graph))
})