a zip code crypto-currency system good for red ONLY

toast.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = Object.setPrototypeOf ||
  3. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5. return function (d, b) {
  6. extendStatics(d, b);
  7. function __() { this.constructor = d; }
  8. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9. };
  10. })();
  11. (function (factory) {
  12. if (typeof module === "object" && typeof module.exports === "object") {
  13. var v = factory(require, exports);
  14. if (v !== undefined) module.exports = v;
  15. }
  16. else if (typeof define === "function" && define.amd) {
  17. define(["require", "exports", "../../util/util", "../app/app-constants", "./toast-component", "./toast-transitions", "../../navigation/view-controller"], factory);
  18. }
  19. })(function (require, exports) {
  20. "use strict";
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. var util_1 = require("../../util/util");
  23. var app_constants_1 = require("../app/app-constants");
  24. var toast_component_1 = require("./toast-component");
  25. var toast_transitions_1 = require("./toast-transitions");
  26. var view_controller_1 = require("../../navigation/view-controller");
  27. /**
  28. * @hidden
  29. */
  30. var Toast = (function (_super) {
  31. __extends(Toast, _super);
  32. function Toast(app, opts, config) {
  33. if (opts === void 0) { opts = {}; }
  34. var _this = this;
  35. opts.dismissOnPageChange = util_1.isPresent(opts.dismissOnPageChange) ? !!opts.dismissOnPageChange : false;
  36. _this = _super.call(this, toast_component_1.ToastCmp, opts, null) || this;
  37. _this._app = app;
  38. // set the position to the bottom if not provided
  39. if (!opts.position || !_this.isValidPosition(opts.position)) {
  40. opts.position = TOAST_POSITION_BOTTOM;
  41. }
  42. _this.isOverlay = true;
  43. config.setTransition('toast-slide-in', toast_transitions_1.ToastSlideIn);
  44. config.setTransition('toast-slide-out', toast_transitions_1.ToastSlideOut);
  45. config.setTransition('toast-md-slide-in', toast_transitions_1.ToastMdSlideIn);
  46. config.setTransition('toast-md-slide-out', toast_transitions_1.ToastMdSlideOut);
  47. config.setTransition('toast-wp-slide-out', toast_transitions_1.ToastWpPopOut);
  48. config.setTransition('toast-wp-slide-in', toast_transitions_1.ToastWpPopIn);
  49. return _this;
  50. }
  51. /**
  52. * @hidden
  53. */
  54. Toast.prototype.getTransitionName = function (direction) {
  55. var key = 'toast' + (direction === 'back' ? 'Leave' : 'Enter');
  56. return this._nav && this._nav.config.get(key);
  57. };
  58. /**
  59. * @hidden
  60. */
  61. Toast.prototype.isValidPosition = function (position) {
  62. return position === TOAST_POSITION_TOP || position === TOAST_POSITION_MIDDLE || position === TOAST_POSITION_BOTTOM;
  63. };
  64. /**
  65. * @param {string} message Toast message content
  66. */
  67. Toast.prototype.setMessage = function (message) {
  68. this.data.message = message;
  69. return this;
  70. };
  71. /**
  72. * @param {number} dur Toast message duration
  73. */
  74. Toast.prototype.setDuration = function (dur) {
  75. this.data.duration = dur;
  76. return this;
  77. };
  78. /**
  79. * @param {'top'|'middle'|'bottom'} pos Toast message position
  80. */
  81. Toast.prototype.setPosition = function (pos) {
  82. this.data.position = pos;
  83. return this;
  84. };
  85. /**
  86. * @param {string} cssClass Toast message CSS class
  87. */
  88. Toast.prototype.setCssClass = function (cssClass) {
  89. this.data.cssClass = cssClass;
  90. return this;
  91. };
  92. /**
  93. * @param {boolean} closeButton Toast message close button
  94. */
  95. Toast.prototype.setShowCloseButton = function (closeButton) {
  96. this.data.showCloseButton = closeButton;
  97. return this;
  98. };
  99. /**
  100. * Present the toast instance.
  101. *
  102. * @param {NavOptions} [navOptions={}] Nav options to go with this transition.
  103. * @returns {Promise} Returns a promise which is resolved when the transition has completed.
  104. */
  105. Toast.prototype.present = function (navOptions) {
  106. if (navOptions === void 0) { navOptions = {}; }
  107. navOptions.disableApp = false;
  108. navOptions.keyboardClose = false;
  109. return this._app.present(this, navOptions, app_constants_1.PORTAL_TOAST);
  110. };
  111. /**
  112. * Dismiss all toast components which have been presented.
  113. */
  114. Toast.prototype.dismissAll = function () {
  115. this._nav && this._nav.popAll();
  116. };
  117. return Toast;
  118. }(view_controller_1.ViewController));
  119. exports.Toast = Toast;
  120. var TOAST_POSITION_TOP = 'top';
  121. var TOAST_POSITION_MIDDLE = 'middle';
  122. var TOAST_POSITION_BOTTOM = 'bottom';
  123. });
  124. //# sourceMappingURL=toast.js.map