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

31 lines
936 B
JavaScript
Raw Normal View History

2020-01-03 14:44:51 +08:00
import { Gravity } from "../util/gravity";
export function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
2020-01-03 14:44:51 +08:00
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
2020-01-03 14:44:51 +08:00
}
else {
return context.callNative('modal', 'alert', arg);
2020-01-03 14:44:51 +08:00
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
2020-01-03 14:44:51 +08:00
}
else {
return context.callNative('modal', 'confirm', arg);
2020-01-03 14:44:51 +08:00
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
2020-01-03 14:44:51 +08:00
},
};
}