1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-17 18:44:45 +02:00

32 lines
666 B
TypeScript
Raw Normal View History

2017-12-24 09:36:31 +01:00
const smalltalk = require('smalltalk');
class Dialogs {
async alert(message: string, title = '') {
2017-12-24 09:36:31 +01:00
await smalltalk.alert(title, message);
}
async confirm(message: string, title = '', options: any = {}) {
2017-12-24 09:36:31 +01:00
try {
await smalltalk.confirm(title, message, options);
2017-12-24 09:36:31 +01:00
return true;
} catch (error) {
return false;
}
}
async prompt(message: string, title = '', defaultValue = '', options: any = null) {
2017-12-24 09:36:31 +01:00
if (options === null) options = {};
try {
const answer = await smalltalk.prompt(title, message, defaultValue, options);
return answer;
} catch (error) {
return null;
}
}
}
const dialogs = new Dialogs();
export default dialogs;