a zip code crypto-currency system good for red ONLY

util.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * @private
  3. */
  4. export var get = function (element, path) {
  5. var paths = path.split('.');
  6. var obj = element;
  7. for (var i = 0; i < paths.length; i++) {
  8. if (!obj) {
  9. return null;
  10. }
  11. obj = obj[paths[i]];
  12. }
  13. return obj;
  14. };
  15. /**
  16. * @private
  17. */
  18. export var getPromise = function (callback) {
  19. var tryNativePromise = function () {
  20. if (window.Promise) {
  21. return new Promise(function (resolve, reject) {
  22. callback(resolve, reject);
  23. });
  24. }
  25. else {
  26. console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.');
  27. }
  28. };
  29. return tryNativePromise();
  30. };
  31. /**
  32. * @private
  33. * @param pluginRef
  34. * @returns {null|*}
  35. */
  36. export var getPlugin = function (pluginRef) {
  37. return get(window, pluginRef);
  38. };
  39. /**
  40. * @private
  41. */
  42. export var pluginWarn = function (pluginName, plugin, method) {
  43. if (method) {
  44. console.warn('Native: tried calling ' +
  45. pluginName +
  46. '.' +
  47. method +
  48. ', but the ' +
  49. pluginName +
  50. ' plugin is not installed.');
  51. }
  52. else {
  53. console.warn("'Native: tried accessing the " + pluginName + " plugin but it's not installed.");
  54. }
  55. if (plugin) {
  56. console.warn("Install the " + pluginName + " plugin: 'ionic cordova plugin add " + plugin + "'");
  57. }
  58. };
  59. /**
  60. * @private
  61. * @param pluginName
  62. * @param method
  63. */
  64. export var cordovaWarn = function (pluginName, method) {
  65. if (method) {
  66. console.warn('Native: tried calling ' +
  67. pluginName +
  68. '.' +
  69. method +
  70. ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
  71. }
  72. else {
  73. console.warn('Native: tried accessing the ' +
  74. pluginName +
  75. ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
  76. }
  77. };
  78. //# sourceMappingURL=util.js.map