31 lines
936 B
JavaScript
31 lines
936 B
JavaScript
import { Gravity } from "../util/gravity";
|
|
export function modal(context) {
|
|
return {
|
|
toast: (msg, gravity = Gravity.Bottom) => {
|
|
context.callNative('modal', 'toast', {
|
|
msg,
|
|
gravity: gravity.toModel(),
|
|
});
|
|
},
|
|
alert: (arg) => {
|
|
if (typeof arg === 'string') {
|
|
return context.callNative('modal', 'alert', { msg: arg });
|
|
}
|
|
else {
|
|
return context.callNative('modal', 'alert', arg);
|
|
}
|
|
},
|
|
confirm: (arg) => {
|
|
if (typeof arg === 'string') {
|
|
return context.callNative('modal', 'confirm', { msg: arg });
|
|
}
|
|
else {
|
|
return context.callNative('modal', 'confirm', arg);
|
|
}
|
|
},
|
|
prompt: (arg) => {
|
|
return context.callNative('modal', 'prompt', arg);
|
|
},
|
|
};
|
|
}
|