a zip code crypto-currency system good for red ONLY

alert.js 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import { AlertCmp } from './alert-component';
  2. import { AlertMdPopIn, AlertMdPopOut, AlertPopIn, AlertPopOut, AlertWpPopIn, AlertWpPopOut } from './alert-transitions';
  3. import { isPresent } from '../../util/util';
  4. import { ViewController } from '../../navigation/view-controller';
  5. /**
  6. * @hidden
  7. */
  8. export class Alert extends ViewController {
  9. constructor(app, opts = {}, config) {
  10. opts.inputs = opts.inputs || [];
  11. opts.buttons = opts.buttons || [];
  12. opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
  13. super(AlertCmp, opts, null);
  14. this._app = app;
  15. this.isOverlay = true;
  16. config.setTransition('alert-pop-in', AlertPopIn);
  17. config.setTransition('alert-pop-out', AlertPopOut);
  18. config.setTransition('alert-md-pop-in', AlertMdPopIn);
  19. config.setTransition('alert-md-pop-out', AlertMdPopOut);
  20. config.setTransition('alert-wp-pop-in', AlertWpPopIn);
  21. config.setTransition('alert-wp-pop-out', AlertWpPopOut);
  22. }
  23. /**
  24. * @hidden
  25. */
  26. getTransitionName(direction) {
  27. let key = (direction === 'back' ? 'alertLeave' : 'alertEnter');
  28. return this._nav && this._nav.config.get(key);
  29. }
  30. /**
  31. * @param {string} title Alert title
  32. */
  33. setTitle(title) {
  34. this.data.title = title;
  35. return this;
  36. }
  37. /**
  38. * @param {string} subTitle Alert subtitle
  39. */
  40. setSubTitle(subTitle) {
  41. this.data.subTitle = subTitle;
  42. return this;
  43. }
  44. /**
  45. * @param {string} message Alert message content
  46. */
  47. setMessage(message) {
  48. this.data.message = message;
  49. return this;
  50. }
  51. /**
  52. * @param {object} input Alert input
  53. */
  54. addInput(input) {
  55. this.data.inputs.push(input);
  56. return this;
  57. }
  58. /**
  59. * @param {any} button Alert button
  60. */
  61. addButton(button) {
  62. this.data.buttons.push(button);
  63. return this;
  64. }
  65. /**
  66. * @param {string} cssClass Set the CSS class names on the alert's outer wrapper.
  67. */
  68. setCssClass(cssClass) {
  69. this.data.cssClass = cssClass;
  70. return this;
  71. }
  72. /**
  73. * @param {string} mode Set the mode of the alert (ios, md, wp).
  74. */
  75. setMode(mode) {
  76. this.data.mode = mode;
  77. }
  78. /**
  79. * Present the alert instance.
  80. *
  81. * @param {NavOptions} [navOptions={}] Nav options to go with this transition.
  82. * @returns {Promise} Returns a promise which is resolved when the transition has completed.
  83. */
  84. present(navOptions = {}) {
  85. navOptions.minClickBlockDuration = navOptions.minClickBlockDuration || 400;
  86. return this._app.present(this, navOptions);
  87. }
  88. }
  89. //# sourceMappingURL=alert.js.map