Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

fade-animator.js 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
  2. import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  3. import _createClass from 'babel-runtime/helpers/createClass';
  4. import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
  5. import _inherits from 'babel-runtime/helpers/inherits';
  6. /*
  7. Copyright 2013-2015 ASIAL CORPORATION
  8. Licensed under the Apache License, Version 2.0 (the "License");
  9. you may not use this file except in compliance with the License.
  10. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. */
  18. import animit from '../../ons/animit';
  19. import ToastAnimator from './animator';
  20. /**
  21. * iOS style animator for dialog.
  22. */
  23. var FadeToastAnimator = function (_ToastAnimator) {
  24. _inherits(FadeToastAnimator, _ToastAnimator);
  25. function FadeToastAnimator() {
  26. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  27. _ref$timing = _ref.timing,
  28. timing = _ref$timing === undefined ? 'linear' : _ref$timing,
  29. _ref$delay = _ref.delay,
  30. delay = _ref$delay === undefined ? 0 : _ref$delay,
  31. _ref$duration = _ref.duration,
  32. duration = _ref$duration === undefined ? 0.3 : _ref$duration;
  33. _classCallCheck(this, FadeToastAnimator);
  34. return _possibleConstructorReturn(this, (FadeToastAnimator.__proto__ || _Object$getPrototypeOf(FadeToastAnimator)).call(this, { timing: timing, delay: delay, duration: duration }));
  35. }
  36. /**
  37. * @param {HTMLElement} toast
  38. * @param {Function} callback
  39. */
  40. _createClass(FadeToastAnimator, [{
  41. key: 'show',
  42. value: function show(toast, callback) {
  43. callback = callback ? callback : function () {};
  44. animit(toast, this.def).default({ opacity: 0 }, { opacity: 1 }).queue(function (done) {
  45. callback();
  46. done();
  47. }).play();
  48. }
  49. /**
  50. * @param {HTMLElement} toast
  51. * @param {Function} callback
  52. */
  53. }, {
  54. key: 'hide',
  55. value: function hide(toast, callback) {
  56. callback = callback ? callback : function () {};
  57. animit(toast, this.def).default({ opacity: 1 }, { opacity: 0 }).queue(function (done) {
  58. callback();
  59. done();
  60. }).play();
  61. }
  62. }]);
  63. return FadeToastAnimator;
  64. }(ToastAnimator);
  65. export default FadeToastAnimator;