2016-02-04 15:51:13 -05:00
|
|
|
define([], function () {
|
|
|
|
|
|
|
|
return function (options) {
|
|
|
|
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
|
|
|
|
if (typeof options === 'string') {
|
|
|
|
options = {
|
2016-02-15 13:15:08 -05:00
|
|
|
label: '',
|
2016-02-04 15:51:13 -05:00
|
|
|
text: options
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-02-15 13:15:08 -05:00
|
|
|
var result = prompt(options.label || '', options.text || '');
|
2016-02-04 15:51:13 -05:00
|
|
|
|
|
|
|
if (result) {
|
|
|
|
resolve(result);
|
|
|
|
} else {
|
|
|
|
reject(result);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
});
|