Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(WebWorkers): Add support for transitionend events. #6654

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion modules/angular2/src/web_workers/ui/event_dispatcher.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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");
}
Expand Down
8 changes: 8 additions & 0 deletions modules/angular2/src/web_workers/ui/event_serializer.dart
Expand Up @@ -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) {
Expand Down
7 changes: 7 additions & 0 deletions modules/angular2/src/web_workers/ui/event_serializer.ts
Expand Up @@ -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 =
Expand All @@ -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())) {
Expand Down
Expand Up @@ -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;
Expand Down