a zip code crypto-currency system good for red ONLY

haptic.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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", "@angular/core", "../platform/platform"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var core_1 = require("@angular/core");
  13. var platform_1 = require("../platform/platform");
  14. /**
  15. * @name Haptic
  16. * @description
  17. * The `Haptic` class interacts with a haptic engine on the device, if
  18. * available. Generally, Ionic components use this under the hood, but you're
  19. * welcome to get a bit crazy with it if you fancy.
  20. *
  21. * Currently, this uses the Taptic engine on iOS.
  22. *
  23. * @usage
  24. * ```ts
  25. * export class MyClass {
  26. *
  27. * constructor(haptic: Haptic) {
  28. * haptic.selection();
  29. * }
  30. * }
  31. *
  32. * ```
  33. */
  34. var Haptic = (function () {
  35. function Haptic(plt) {
  36. var _this = this;
  37. if (plt) {
  38. plt.ready().then(function () {
  39. _this._p = plt.win().TapticEngine;
  40. });
  41. }
  42. }
  43. /**
  44. * Check to see if the Haptic Plugin is available
  45. * @return {boolean} Returns true or false if the plugin is available
  46. *
  47. */
  48. Haptic.prototype.available = function () {
  49. return !!this._p;
  50. };
  51. /**
  52. * Trigger a selection changed haptic event. Good for one-time events
  53. * (not for gestures)
  54. */
  55. Haptic.prototype.selection = function () {
  56. this._p && this._p.selection();
  57. };
  58. /**
  59. * Tell the haptic engine that a gesture for a selection change is starting.
  60. */
  61. Haptic.prototype.gestureSelectionStart = function () {
  62. this._p && this._p.gestureSelectionStart();
  63. };
  64. /**
  65. * Tell the haptic engine that a selection changed during a gesture.
  66. */
  67. Haptic.prototype.gestureSelectionChanged = function () {
  68. this._p && this._p.gestureSelectionChanged();
  69. };
  70. /**
  71. * Tell the haptic engine we are done with a gesture. This needs to be
  72. * called lest resources are not properly recycled.
  73. */
  74. Haptic.prototype.gestureSelectionEnd = function () {
  75. this._p && this._p.gestureSelectionEnd();
  76. };
  77. /**
  78. * Use this to indicate success/failure/warning to the user.
  79. * options should be of the type `{ type: 'success' }` (or `warning`/`error`)
  80. */
  81. Haptic.prototype.notification = function (options) {
  82. this._p && this._p.notification(options);
  83. };
  84. /**
  85. * Use this to indicate success/failure/warning to the user.
  86. * options should be of the type `{ style: 'light' }` (or `medium`/`heavy`)
  87. */
  88. Haptic.prototype.impact = function (options) {
  89. this._p && this._p.impact(options);
  90. };
  91. Haptic.decorators = [
  92. { type: core_1.Injectable },
  93. ];
  94. /** @nocollapse */
  95. Haptic.ctorParameters = function () { return [
  96. { type: platform_1.Platform, },
  97. ]; };
  98. return Haptic;
  99. }());
  100. exports.Haptic = Haptic;
  101. });
  102. //# sourceMappingURL=haptic.js.map