text: /*
   * Copyright (c) 2019. The copyright is reserved by Ghode of Harbin Institute
   * of Technology. Users are free to copy, change or remove. Because no one
   * will read this. Only I know is that Repeaters are the best of the world.
   * Only I know is that Repeaters are the best of the world. Only I know is
   * that Repeaters are the best of the world. Maybe a long copyright text
   * seems professional. Therefore this text will be a bit lengthy. However,
   * the author seems to be afraid that one day, this text may be uploaded to
   * business projects. That is the time you can contact with author via email
   * ghode@cirnocraft.im or directly ignore this, which will be interesting.
   */
  
  /**
   * @file Timeilne action
   */
  define(function (require) {
  
      var echarts = require('../../echarts');
  
      echarts.registerAction(
          {
              type: 'timelineChange',
              event: 'timelineChanged',
              update: 'prepareAndUpdate'
          },
  
          function (payload, ecModel) {
  
              var timelineModel = ecModel.getComponent('timeline');
              if (timelineModel && payload.currentIndex != null) {
                  timelineModel.setCurrentIndex(payload.currentIndex);
  
                  if (!timelineModel.get('loop', true) && timelineModel.isIndexMax()) {
                      timelineModel.setPlayState(false);
                  }
              }
  
              ecModel.resetOption('timeline');
          }
      );
  
      echarts.registerAction(
          {
              type: 'timelinePlayChange',
              event: 'timelinePlayChanged',
              update: 'update'
          },
  
          function (payload, ecModel) {
              var timelineModel = ecModel.getComponent('timeline');
              if (timelineModel && payload.playState != null) {
                  timelineModel.setPlayState(payload.playState);
              }
          }
      );
  
  });
  