暫無描述

animator.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 util from '../../ons/util';
  19. import BaseAnimator from '../../ons/base-animator';
  20. var NavigatorAnimator = function (_BaseAnimator) {
  21. _inherits(NavigatorAnimator, _BaseAnimator);
  22. /**
  23. * @param {Object} options
  24. * @param {String} options.timing
  25. * @param {Number} options.duration
  26. * @param {Number} options.delay
  27. */
  28. function NavigatorAnimator(options) {
  29. _classCallCheck(this, NavigatorAnimator);
  30. options = util.extend({
  31. timing: 'linear',
  32. duration: '0.4',
  33. delay: '0'
  34. }, options || {});
  35. return _possibleConstructorReturn(this, (NavigatorAnimator.__proto__ || _Object$getPrototypeOf(NavigatorAnimator)).call(this, options));
  36. }
  37. _createClass(NavigatorAnimator, [{
  38. key: 'push',
  39. value: function push(enterPage, leavePage, callback) {
  40. callback();
  41. }
  42. }, {
  43. key: 'pop',
  44. value: function pop(enterPage, leavePage, callback) {
  45. callback();
  46. }
  47. }, {
  48. key: 'block',
  49. value: function block(page) {
  50. var blocker = util.createElement('\n <div style="position: absolute; background-color: transparent; width: 100%; height: 100%; z-index: 100000"></div>\n ');
  51. page.parentNode.appendChild(blocker);
  52. return function () {
  53. return blocker.remove();
  54. };
  55. }
  56. }]);
  57. return NavigatorAnimator;
  58. }(BaseAnimator);
  59. export default NavigatorAnimator;