API Reference 0.3.24dart_web_toolkit_uiStateScheduledCommand

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

new StateScheduledCommand(_State _state, Image _image) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
StateScheduledCommand(this._state, this._image);

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);
}