Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 2x 2x 2x 2x 2x 2x 214x 214x 214x 214x 214x 214x 21x 21x 214x 214x 214x 214x 214x | import Transaction from "../transaction"; // End flow, this terminates the transaction and returns a Promise that // resolves when completed. If you want to make diffHTML return streams or // callbacks replace this function. export default function endAsPromise(/** @type {Transaction} */ transaction) { const { promises } = transaction; // Operate synchronously unless opted into a Promise-chain. Doesn't matter // if they are actually Promises or not, since they will all resolve // eventually with `Promise.all`. if (promises && promises.length) { return transaction.promise = Promise.all(promises).then(() => transaction.end()); } // Pass off the remaining middleware to allow users to dive into the // transaction completed lifecycle event. return transaction.promise = Promise.resolve(transaction.end()); } |