description

# MessageEvent constructor Null safety

MessageEvent(

1. String type,
2. {bool canBubble: false,
3. bool cancelable: false,
4. Object? data,
5. String? origin,
6. String? lastEventId,
7. Window? source,
8. List<MessagePort> messagePorts: const []}

)

## Implementation

    factory MessageEvent(String type,
        {bool canBubble: false,
        bool cancelable: false,
        Object? data,
        String? origin,
        String? lastEventId,
        Window? source,
        List<MessagePort> messagePorts: const []}) {
      if (source == null) {
        source = window;
      }
      if (!Device.isIE) {
        // TODO: This if check should be removed once IE
        // implements the constructor.
        return JS(
            'MessageEvent',
            'new MessageEvent(#, {bubbles: #, cancelable: #, data: #, origin: #, lastEventId: #, source: #, ports: #})',
            type,
            canBubble,
            cancelable,
            data,
            origin,
            lastEventId,
            source,
            messagePorts);
      }
      MessageEvent event = document._createEvent("MessageEvent") as MessageEvent;
      event._initMessageEvent(type, canBubble, cancelable, data, origin,
          lastEventId, source, messagePorts);
      return event;
    }