* @param opt If pass boolean, means opt.silent * @param opt.silent Default `false`. Whether trigger events. * @param opt.flush Default `undefined`. * true: Flush immediately, and then pixel in canvas can be fetched * immediately. Caution: it might affect perform
(
payload: Payload,
opt?: boolean | {
silent?: boolean,
flush?: boolean | undefined
}
)
| 1571 | * undefined: Auto decide whether perform flush. |
| 1572 | */ |
| 1573 | dispatchAction( |
| 1574 | payload: Payload, |
| 1575 | opt?: boolean | { |
| 1576 | silent?: boolean, |
| 1577 | flush?: boolean | undefined |
| 1578 | } |
| 1579 | ): void { |
| 1580 | if (this._disposed) { |
| 1581 | disposedWarning(this.id); |
| 1582 | return; |
| 1583 | } |
| 1584 | |
| 1585 | if (!isObject(opt)) { |
| 1586 | opt = {silent: !!opt}; |
| 1587 | } |
| 1588 | |
| 1589 | if (!actions[payload.type]) { |
| 1590 | return; |
| 1591 | } |
| 1592 | |
| 1593 | // Avoid dispatch action before setOption. Especially in `connect`. |
| 1594 | if (!this._model) { |
| 1595 | return; |
| 1596 | } |
| 1597 | |
| 1598 | // May dispatchAction in rendering procedure |
| 1599 | if (this[IN_EC_CYCLE_KEY]) { |
| 1600 | this._pendingActions.push(payload); |
| 1601 | return; |
| 1602 | } |
| 1603 | |
| 1604 | const silent = opt.silent; |
| 1605 | doDispatchAction.call(this, payload, silent); |
| 1606 | |
| 1607 | const flush = opt.flush; |
| 1608 | if (flush) { |
| 1609 | this._zr.flush(); |
| 1610 | } |
| 1611 | else if (flush !== false && env.browser.weChat) { |
| 1612 | // In WeChat embedded browser, `requestAnimationFrame` and `setInterval` |
| 1613 | // hang when sliding page (on touch event), which cause that zr does not |
| 1614 | // refresh until user interaction finished, which is not expected. |
| 1615 | // But `dispatchAction` may be called too frequently when pan on touch |
| 1616 | // screen, which impacts performance if do not throttle them. |
| 1617 | this._throttledZrFlush(); |
| 1618 | } |
| 1619 | |
| 1620 | flushPendingActions.call(this, silent); |
| 1621 | |
| 1622 | triggerUpdatedEvent.call(this, silent); |
| 1623 | } |
| 1624 | |
| 1625 | updateLabelLayout() { |
| 1626 | lifecycle.trigger('series:layoutlabels', this._model, this._api, { |
no test coverage detected