a zip code crypto-currency system good for red ONLY

nav-util.js 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. (function (factory) {
  2. if (typeof module === "object" && typeof module.exports === "object") {
  3. var v = factory(require, exports);
  4. if (v !== undefined) module.exports = v;
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. define(["require", "exports", "../util/util", "./view-controller"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var util_1 = require("../util/util");
  13. var view_controller_1 = require("./view-controller");
  14. function getComponent(linker, nameOrPageOrView, params) {
  15. if (typeof nameOrPageOrView === 'function') {
  16. return Promise.resolve(new view_controller_1.ViewController(nameOrPageOrView, params));
  17. }
  18. if (typeof nameOrPageOrView === 'string') {
  19. return linker.getComponentFromName(nameOrPageOrView).then(function (component) {
  20. var vc = new view_controller_1.ViewController(component, params);
  21. vc.id = nameOrPageOrView;
  22. return vc;
  23. });
  24. }
  25. return Promise.resolve(null);
  26. }
  27. exports.getComponent = getComponent;
  28. function convertToView(linker, nameOrPageOrView, params) {
  29. if (nameOrPageOrView) {
  30. if (view_controller_1.isViewController(nameOrPageOrView)) {
  31. // is already a ViewController
  32. return Promise.resolve(nameOrPageOrView);
  33. }
  34. return getComponent(linker, nameOrPageOrView, params);
  35. }
  36. return Promise.resolve(null);
  37. }
  38. exports.convertToView = convertToView;
  39. function convertToViews(linker, pages) {
  40. var views = [];
  41. if (util_1.isArray(pages)) {
  42. for (var i = 0; i < pages.length; i++) {
  43. var page = pages[i];
  44. if (page) {
  45. if (view_controller_1.isViewController(page)) {
  46. views.push(page);
  47. }
  48. else if (page.page) {
  49. views.push(convertToView(linker, page.page, page.params));
  50. }
  51. else {
  52. views.push(convertToView(linker, page, null));
  53. }
  54. }
  55. }
  56. }
  57. return Promise.all(views);
  58. }
  59. exports.convertToViews = convertToViews;
  60. var portalZindex = 9999;
  61. function setZIndex(nav, enteringView, leavingView, direction, renderer) {
  62. if (enteringView) {
  63. if (nav._isPortal) {
  64. if (direction === exports.DIRECTION_FORWARD) {
  65. enteringView._setZIndex(nav._zIndexOffset + portalZindex, renderer);
  66. }
  67. portalZindex++;
  68. return;
  69. }
  70. leavingView = leavingView || nav.getPrevious(enteringView);
  71. if (leavingView && util_1.isPresent(leavingView._zIndex)) {
  72. if (direction === exports.DIRECTION_BACK) {
  73. enteringView._setZIndex(leavingView._zIndex - 1, renderer);
  74. }
  75. else {
  76. enteringView._setZIndex(leavingView._zIndex + 1, renderer);
  77. }
  78. }
  79. else {
  80. enteringView._setZIndex(exports.INIT_ZINDEX + nav._zIndexOffset, renderer);
  81. }
  82. }
  83. }
  84. exports.setZIndex = setZIndex;
  85. function isTabs(nav) {
  86. // Tabs (ion-tabs)
  87. return !!nav && !!nav.getSelected;
  88. }
  89. exports.isTabs = isTabs;
  90. function isTab(nav) {
  91. // Tab (ion-tab)
  92. return !!nav && util_1.isPresent(nav._tabId);
  93. }
  94. exports.isTab = isTab;
  95. function isNav(nav) {
  96. // Nav (ion-nav), Tab (ion-tab), Portal (ion-portal)
  97. return !!nav && !!nav.push && nav.getType() === 'nav';
  98. }
  99. exports.isNav = isNav;
  100. function linkToSegment(navId, type, secondaryId, link) {
  101. var segment = Object.assign({}, link);
  102. segment.navId = navId;
  103. segment.type = type;
  104. segment.secondaryId = secondaryId;
  105. return segment;
  106. }
  107. exports.linkToSegment = linkToSegment;
  108. /**
  109. * @hidden
  110. */
  111. var DeepLinkMetadata = (function () {
  112. function DeepLinkMetadata() {
  113. }
  114. return DeepLinkMetadata;
  115. }());
  116. exports.DeepLinkMetadata = DeepLinkMetadata;
  117. exports.STATE_NEW = 1;
  118. exports.STATE_INITIALIZED = 2;
  119. exports.STATE_ATTACHED = 3;
  120. exports.STATE_DESTROYED = 4;
  121. exports.INIT_ZINDEX = 100;
  122. exports.DIRECTION_BACK = 'back';
  123. exports.DIRECTION_FORWARD = 'forward';
  124. exports.DIRECTION_SWITCH = 'switch';
  125. exports.NAV = 'nav';
  126. exports.TABS = 'tabs';
  127. });
  128. //# sourceMappingURL=nav-util.js.map