StateScheduledCommand class
class StateScheduledCommand extends ScheduledCommand {
_State _state;
Image _image;
StateScheduledCommand(this._state, this._image);
void execute() {
/*
* The state has been replaced, or another load event is already
* pending.
*/
if (_image._state != _state || this != _state.syntheticEventCommand) {
return;
}
_state.syntheticEventCommand = null;
/*
* The image is not attached, so we cannot safely fire the event. We
* still want the event to fire eventually, so we mark an unhandled
* load event, which will trigger a new synthetic event the next time
* the widget is attached.
*/
if (!_image.isAttached()) {
_state.getImageElement(_image).dataset[DomImpl.UNHANDLED_EVENT_ATTR] = BrowserEvents.LOAD;
return;
}
dart_html.Event evt = Dom.createLoadEvent();
_state.getImageElement(_image).dispatchEvent(evt);
}
}
Extends
ScheduledCommand > StateScheduledCommand
Constructors
Methods
void execute() #
Invokes the command.
docs inherited from ScheduledCommand
void execute() {
/*
* The state has been replaced, or another load event is already
* pending.
*/
if (_image._state != _state || this != _state.syntheticEventCommand) {
return;
}
_state.syntheticEventCommand = null;
/*
* The image is not attached, so we cannot safely fire the event. We
* still want the event to fire eventually, so we mark an unhandled
* load event, which will trigger a new synthetic event the next time
* the widget is attached.
*/
if (!_image.isAttached()) {
_state.getImageElement(_image).dataset[DomImpl.UNHANDLED_EVENT_ATTR] = BrowserEvents.LOAD;
return;
}
dart_html.Event evt = Dom.createLoadEvent();
_state.getImageElement(_image).dispatchEvent(evt);
}