fix(WebWorkers): Add support for transitionend events.

Closes #6649
This commit is contained in:
Jason Teplitz 2016-01-22 14:10:20 -08:00 committed by Rado Kirov
parent 8bea667a0b
commit c2a38c05aa
4 changed files with 24 additions and 1 deletions

View File

@ -3,7 +3,8 @@ import {
serializeMouseEvent,
serializeKeyboardEvent,
serializeGenericEvent,
serializeEventWithTarget
serializeEventWithTarget,
serializeTransitionEvent
} from 'angular2/src/web_workers/ui/event_serializer';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import {StringMapWrapper} from 'angular2/src/facade/collection';
@ -89,6 +90,9 @@ export class EventDispatcher {
case "waiting":
serializedEvent = serializeGenericEvent(event);
break;
case "transitionend":
serializedEvent = serializeTransitionEvent(event);
break;
default:
throw new BaseException(eventName + " not supported on WebWorkers");
}

View File

@ -86,6 +86,14 @@ Map<String, dynamic> serializeKeyboardEvent(dynamic e) {
return serialized;
}
Map<String, dynamic> serializeTransitionEvent(dynamic e) {
var serialized = serializeGenericEvent(e);
serialized['propertyName'] = e.propertyName;
serialized['elapsedTime'] = e.elapsedTime;
serialized['pseudoElement'] = e.pseudoElement;
return addTarget(e, serialized);
}
// TODO(jteplitz602): #3374. See above.
Map<String, dynamic> addTarget(
dynamic e, Map<String, dynamic> serializedEvent) {

View File

@ -32,6 +32,8 @@ const KEYBOARD_EVENT_PROPERTIES = [
'which'
];
const TRANSITION_EVENT_PROPERTIES = ['propertyName', 'elapsedTime', 'pseudoElement'];
const EVENT_PROPERTIES = ['type', 'bubbles', 'cancelable'];
const NODES_WITH_VALUE =
@ -57,6 +59,11 @@ export function serializeKeyboardEvent(e: KeyboardEvent): {[key: string]: any} {
return addTarget(e, serializedEvent);
}
export function serializeTransitionEvent(e: TransitionEvent): {[key: string]: any} {
var serializedEvent = serializeEvent(e, TRANSITION_EVENT_PROPERTIES);
return addTarget(e, serializedEvent);
}
// TODO(jteplitz602): #3374. See above.
function addTarget(e: Event, serializedEvent: {[key: string]: any}): {[key: string]: any} {
if (NODES_WITH_VALUE.has((<HTMLElement>e.target).tagName.toLowerCase())) {

View File

@ -31,6 +31,10 @@ class GenericEvent {
Point get page => _getPoint('page');
Point get screen => _getPoint('screen');
String get propertyName => properties['propertyName'];
num get elapsedTime => properties['elapsedTime'];
String get pseudoElement => properties['pseudoElement'];
EventTarget get target {
if (_target != null) {
return _target;