API Reference 0.3.24dart_web_toolkit_placeClosingHandlerRegistration

ClosingHandlerRegistration class

Class wrapping window's before closing event in HandlerRegistration manner.

class ClosingHandlerRegistration implements HandlerRegistration {
 
 ClosingHandler _handler;
 dart_async.StreamSubscription listener;
 
 ClosingHandlerRegistration(_handler) {
   listener = dart_html.window.onBeforeUnload.listen(_onData);
 }
 
 void _onData(dart_html.Event evt) {
   ClosingEvent event = new ClosingEvent();
   _handler.onWindowClosing(event);
 }
 
 /**
  * Deregisters the handler associated with this registration object if the
  * handler is still attached to the event source. If the handler is no longer
  * attached to the event source, this is a no-op.
  */
 void removeHandler() {
   listener.cancel();
 }
}

Implements

HandlerRegistration

Constructors

new ClosingHandlerRegistration(_handler) #

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
ClosingHandlerRegistration(_handler) {
 listener = dart_html.window.onBeforeUnload.listen(_onData);
}

Properties

StreamSubscription listener #

dart_async.StreamSubscription listener

Methods

void removeHandler() #

Deregisters the handler associated with this registration object if the handler is still attached to the event source. If the handler is no longer attached to the event source, this is a no-op.

void removeHandler() {
 listener.cancel();
}