This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-js/lib/src/native/modal.js
2020-01-03 17:05:24 +08:00

31 lines
834 B
JavaScript

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