pcsx-redux/tools/vscode-extension/progressnotification.js
2023-02-25 17:51:51 -08:00

29 lines
690 B
JavaScript

'use strict'
const vscode = require('vscode')
exports.notify = async function (title, message) {
let progressReporter
let progressResolver
const notificationDisplayed = new Promise((notificationReady) => {
vscode.window.withProgress(
{
location: vscode.ProgressLocation.Notification,
title,
cancellable: true
},
(progress) => {
progress.report({ message, increment: 0 })
progressReporter = progress
return new Promise((resolve) => {
notificationReady()
progressResolver = resolve
})
}
)
})
await notificationDisplayed
return { progressReporter, progressResolver }
}