chore(typings): remove StringMap
This was a poorly typed attempt to mimic TypeScript's index signatures, which we can use instead. This eliminates a very strange type that we were exposing to users, but not re-exporting through our public API. Fixes #4483
This commit is contained in:
parent
2ebc74ddcc
commit
7c4199cd1c
|
@ -2,7 +2,6 @@
|
||||||
{% block staticDeclarations %}
|
{% block staticDeclarations %}
|
||||||
|
|
||||||
interface Map<K,V> {}
|
interface Map<K,V> {}
|
||||||
interface StringMap<K,V> extends Map<K,V> {}
|
|
||||||
|
|
||||||
{% for alias, module in doc.moduleDocs %}
|
{% for alias, module in doc.moduleDocs %}
|
||||||
declare module {$ module.namespace $} {
|
declare module {$ module.namespace $} {
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
/// <reference path="../typings/zone/zone.d.ts"/>
|
/// <reference path="../typings/zone/zone.d.ts"/>
|
||||||
declare var assert: any;
|
declare var assert: any;
|
||||||
|
|
||||||
// FIXME: K must be string!
|
|
||||||
// FIXME: should have an index signature, `[k: string]: V;`
|
|
||||||
interface StringMap<K extends string, V> {}
|
|
||||||
|
|
||||||
interface BrowserNodeGlobal {
|
interface BrowserNodeGlobal {
|
||||||
Object: typeof Object;
|
Object: typeof Object;
|
||||||
Array: typeof Array;
|
Array: typeof Array;
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class Animation {
|
||||||
* Applies the provided styles to the element
|
* Applies the provided styles to the element
|
||||||
* @param styles
|
* @param styles
|
||||||
*/
|
*/
|
||||||
applyStyles(styles: StringMap<string, any>): void {
|
applyStyles(styles: {[key: string]: any}): void {
|
||||||
StringMapWrapper.forEach(styles, (value, key) => {
|
StringMapWrapper.forEach(styles, (value, key) => {
|
||||||
var dashCaseKey = camelCaseToDashCase(key);
|
var dashCaseKey = camelCaseToDashCase(key);
|
||||||
if (isPresent(DOM.getStyle(this.element, dashCaseKey))) {
|
if (isPresent(DOM.getStyle(this.element, dashCaseKey))) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ export class CssAnimationBuilder {
|
||||||
* @param from
|
* @param from
|
||||||
* @param to
|
* @param to
|
||||||
*/
|
*/
|
||||||
setStyles(from: StringMap<string, any>, to: StringMap<string, any>): CssAnimationBuilder {
|
setStyles(from: {[key: string]: any}, to: {[key: string]: any}): CssAnimationBuilder {
|
||||||
return this.setFromStyles(from).setToStyles(to);
|
return this.setFromStyles(from).setToStyles(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ export class CssAnimationBuilder {
|
||||||
* Sets the initial styles for the animation
|
* Sets the initial styles for the animation
|
||||||
* @param from
|
* @param from
|
||||||
*/
|
*/
|
||||||
setFromStyles(from: StringMap<string, any>): CssAnimationBuilder {
|
setFromStyles(from: {[key: string]: any}): CssAnimationBuilder {
|
||||||
this.data.fromStyles = from;
|
this.data.fromStyles = from;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ export class CssAnimationBuilder {
|
||||||
* Sets the destination styles for the animation
|
* Sets the destination styles for the animation
|
||||||
* @param to
|
* @param to
|
||||||
*/
|
*/
|
||||||
setToStyles(to: StringMap<string, any>): CssAnimationBuilder {
|
setToStyles(to: {[key: string]: any}): CssAnimationBuilder {
|
||||||
this.data.toStyles = to;
|
this.data.toStyles = to;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
export class CssAnimationOptions {
|
export class CssAnimationOptions {
|
||||||
/** initial styles for the element */
|
/** initial styles for the element */
|
||||||
fromStyles: StringMap<string, any>;
|
fromStyles: {[key: string]: any};
|
||||||
|
|
||||||
/** destination styles for the element */
|
/** destination styles for the element */
|
||||||
toStyles: StringMap<string, any>;
|
toStyles: {[key: string]: any};
|
||||||
|
|
||||||
/** classes to be added to the element */
|
/** classes to be added to the element */
|
||||||
classesToAdd: string[] = [];
|
classesToAdd: string[] = [];
|
||||||
|
|
|
@ -278,7 +278,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||||
this.dispatcher.logBindingUpdate(this._currentBinding(), value);
|
this.dispatcher.logBindingUpdate(this._currentBinding(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
addChange(changes: StringMap<string, any>, oldValue: any, newValue: any): StringMap<string, any> {
|
addChange(changes: {[key: string]: any}, oldValue: any, newValue: any): {[key: string]: any} {
|
||||||
if (isBlank(changes)) {
|
if (isBlank(changes)) {
|
||||||
changes = {};
|
changes = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ export class ChangeDetectionUtil {
|
||||||
static cond(cond, trueVal, falseVal): any { return cond ? trueVal : falseVal; }
|
static cond(cond, trueVal, falseVal): any { return cond ? trueVal : falseVal; }
|
||||||
|
|
||||||
static mapFn(keys: any[]): any {
|
static mapFn(keys: any[]): any {
|
||||||
function buildMap(values): StringMap<any, any> {
|
function buildMap(values): {[k: /*any*/ string]: any} {
|
||||||
var res = StringMapWrapper.create();
|
var res = StringMapWrapper.create();
|
||||||
for (var i = 0; i < keys.length; ++i) {
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
StringMapWrapper.set(res, keys[i], values[i]);
|
StringMapWrapper.set(res, keys[i], values[i]);
|
||||||
|
|
|
@ -34,12 +34,12 @@ export class CompileTypeMetadata {
|
||||||
this.isHost = normalizeBool(isHost);
|
this.isHost = normalizeBool(isHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(data: StringMap<string, any>): CompileTypeMetadata {
|
static fromJson(data: {[key: string]: any}): CompileTypeMetadata {
|
||||||
return new CompileTypeMetadata(
|
return new CompileTypeMetadata(
|
||||||
{name: data['name'], moduleUrl: data['moduleUrl'], isHost: data['isHost']});
|
{name: data['name'], moduleUrl: data['moduleUrl'], isHost: data['isHost']});
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson(): StringMap<string, any> {
|
toJson(): {[key: string]: any} {
|
||||||
return {
|
return {
|
||||||
// Note: Runtime type can't be serialized...
|
// Note: Runtime type can't be serialized...
|
||||||
'name': this.name,
|
'name': this.name,
|
||||||
|
@ -72,7 +72,7 @@ export class CompileTemplateMetadata {
|
||||||
this.ngContentSelectors = isPresent(ngContentSelectors) ? ngContentSelectors : [];
|
this.ngContentSelectors = isPresent(ngContentSelectors) ? ngContentSelectors : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(data: StringMap<string, any>): CompileTemplateMetadata {
|
static fromJson(data: {[key: string]: any}): CompileTemplateMetadata {
|
||||||
return new CompileTemplateMetadata({
|
return new CompileTemplateMetadata({
|
||||||
encapsulation: isPresent(data['encapsulation']) ?
|
encapsulation: isPresent(data['encapsulation']) ?
|
||||||
VIEW_ENCAPSULATION_VALUES[data['encapsulation']] :
|
VIEW_ENCAPSULATION_VALUES[data['encapsulation']] :
|
||||||
|
@ -85,7 +85,7 @@ export class CompileTemplateMetadata {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson(): StringMap<string, any> {
|
toJson(): {[key: string]: any} {
|
||||||
return {
|
return {
|
||||||
'encapsulation':
|
'encapsulation':
|
||||||
isPresent(this.encapsulation) ? serializeEnum(this.encapsulation) : this.encapsulation,
|
isPresent(this.encapsulation) ? serializeEnum(this.encapsulation) : this.encapsulation,
|
||||||
|
@ -109,7 +109,7 @@ export class CompileDirectiveMetadata {
|
||||||
changeDetection?: ChangeDetectionStrategy,
|
changeDetection?: ChangeDetectionStrategy,
|
||||||
inputs?: string[],
|
inputs?: string[],
|
||||||
outputs?: string[],
|
outputs?: string[],
|
||||||
host?: StringMap<string, string>,
|
host?: {[key: string]: string},
|
||||||
lifecycleHooks?: LifecycleHooks[],
|
lifecycleHooks?: LifecycleHooks[],
|
||||||
template?: CompileTemplateMetadata
|
template?: CompileTemplateMetadata
|
||||||
} = {}): CompileDirectiveMetadata {
|
} = {}): CompileDirectiveMetadata {
|
||||||
|
@ -169,11 +169,11 @@ export class CompileDirectiveMetadata {
|
||||||
selector: string;
|
selector: string;
|
||||||
exportAs: string;
|
exportAs: string;
|
||||||
changeDetection: ChangeDetectionStrategy;
|
changeDetection: ChangeDetectionStrategy;
|
||||||
inputs: StringMap<string, string>;
|
inputs: {[key: string]: string};
|
||||||
outputs: StringMap<string, string>;
|
outputs: {[key: string]: string};
|
||||||
hostListeners: StringMap<string, string>;
|
hostListeners: {[key: string]: string};
|
||||||
hostProperties: StringMap<string, string>;
|
hostProperties: {[key: string]: string};
|
||||||
hostAttributes: StringMap<string, string>;
|
hostAttributes: {[key: string]: string};
|
||||||
lifecycleHooks: LifecycleHooks[];
|
lifecycleHooks: LifecycleHooks[];
|
||||||
template: CompileTemplateMetadata;
|
template: CompileTemplateMetadata;
|
||||||
constructor({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, inputs,
|
constructor({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, inputs,
|
||||||
|
@ -184,11 +184,11 @@ export class CompileDirectiveMetadata {
|
||||||
selector?: string,
|
selector?: string,
|
||||||
exportAs?: string,
|
exportAs?: string,
|
||||||
changeDetection?: ChangeDetectionStrategy,
|
changeDetection?: ChangeDetectionStrategy,
|
||||||
inputs?: StringMap<string, string>,
|
inputs?: {[key: string]: string},
|
||||||
outputs?: StringMap<string, string>,
|
outputs?: {[key: string]: string},
|
||||||
hostListeners?: StringMap<string, string>,
|
hostListeners?: {[key: string]: string},
|
||||||
hostProperties?: StringMap<string, string>,
|
hostProperties?: {[key: string]: string},
|
||||||
hostAttributes?: StringMap<string, string>,
|
hostAttributes?: {[key: string]: string},
|
||||||
lifecycleHooks?: LifecycleHooks[],
|
lifecycleHooks?: LifecycleHooks[],
|
||||||
template?: CompileTemplateMetadata
|
template?: CompileTemplateMetadata
|
||||||
} = {}) {
|
} = {}) {
|
||||||
|
@ -207,7 +207,7 @@ export class CompileDirectiveMetadata {
|
||||||
this.template = template;
|
this.template = template;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(data: StringMap<string, any>): CompileDirectiveMetadata {
|
static fromJson(data: {[key: string]: any}): CompileDirectiveMetadata {
|
||||||
return new CompileDirectiveMetadata({
|
return new CompileDirectiveMetadata({
|
||||||
isComponent: data['isComponent'],
|
isComponent: data['isComponent'],
|
||||||
dynamicLoadable: data['dynamicLoadable'],
|
dynamicLoadable: data['dynamicLoadable'],
|
||||||
|
@ -229,7 +229,7 @@ export class CompileDirectiveMetadata {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson(): StringMap<string, any> {
|
toJson(): {[key: string]: any} {
|
||||||
return {
|
return {
|
||||||
'isComponent': this.isComponent,
|
'isComponent': this.isComponent,
|
||||||
'dynamicLoadable': this.dynamicLoadable,
|
'dynamicLoadable': this.dynamicLoadable,
|
||||||
|
|
|
@ -436,8 +436,8 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
return directiveAsts;
|
return directiveAsts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createDirectiveHostPropertyAsts(elementName: string,
|
private _createDirectiveHostPropertyAsts(elementName: string, hostProps: {[key: string]: string},
|
||||||
hostProps: StringMap<string, string>, sourceInfo: string,
|
sourceInfo: string,
|
||||||
targetPropertyAsts: BoundElementPropertyAst[]) {
|
targetPropertyAsts: BoundElementPropertyAst[]) {
|
||||||
if (isPresent(hostProps)) {
|
if (isPresent(hostProps)) {
|
||||||
StringMapWrapper.forEach(hostProps, (expression, propName) => {
|
StringMapWrapper.forEach(hostProps, (expression, propName) => {
|
||||||
|
@ -448,8 +448,8 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createDirectiveHostEventAsts(hostListeners: StringMap<string, string>,
|
private _createDirectiveHostEventAsts(hostListeners: {[key: string]: string}, sourceInfo: string,
|
||||||
sourceInfo: string, targetEventAsts: BoundEventAst[]) {
|
targetEventAsts: BoundEventAst[]) {
|
||||||
if (isPresent(hostListeners)) {
|
if (isPresent(hostListeners)) {
|
||||||
StringMapWrapper.forEach(hostListeners, (expression, propName) => {
|
StringMapWrapper.forEach(hostListeners, (expression, propName) => {
|
||||||
this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts);
|
this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts);
|
||||||
|
@ -457,7 +457,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createDirectivePropertyAsts(directiveProperties: StringMap<string, string>,
|
private _createDirectivePropertyAsts(directiveProperties: {[key: string]: string},
|
||||||
boundProps: BoundElementOrDirectiveProperty[],
|
boundProps: BoundElementOrDirectiveProperty[],
|
||||||
targetBoundDirectiveProps: BoundDirectivePropertyAst[]) {
|
targetBoundDirectiveProps: BoundDirectivePropertyAst[]) {
|
||||||
if (isPresent(directiveProperties)) {
|
if (isPresent(directiveProperties)) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export abstract class DomAdapter {
|
||||||
* Maps attribute names to their corresponding property names for cases
|
* Maps attribute names to their corresponding property names for cases
|
||||||
* where attribute name doesn't match property name.
|
* where attribute name doesn't match property name.
|
||||||
*/
|
*/
|
||||||
attrToPropMap: StringMap<string, string>;
|
attrToPropMap: {[key: string]: string};
|
||||||
|
|
||||||
abstract parse(templateHtml: string);
|
abstract parse(templateHtml: string);
|
||||||
abstract query(selector: string): any;
|
abstract query(selector: string): any;
|
||||||
|
|
|
@ -115,9 +115,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
on(el, evt, listener) {
|
on(el, evt, listener) {
|
||||||
var listenersMap: StringMap<any, any> = el._eventListenersMap;
|
var listenersMap: {[k: /*any*/ string]: any} = el._eventListenersMap;
|
||||||
if (isBlank(listenersMap)) {
|
if (isBlank(listenersMap)) {
|
||||||
var listenersMap: StringMap<any, any> = StringMapWrapper.create();
|
var listenersMap: {[k: /*any*/ string]: any} = StringMapWrapper.create();
|
||||||
el._eventListenersMap = listenersMap;
|
el._eventListenersMap = listenersMap;
|
||||||
}
|
}
|
||||||
var listeners = StringMapWrapper.get(listenersMap, evt);
|
var listeners = StringMapWrapper.get(listenersMap, evt);
|
||||||
|
@ -492,7 +492,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
var rules = [];
|
var rules = [];
|
||||||
for (var i = 0; i < parsedRules.length; i++) {
|
for (var i = 0; i < parsedRules.length; i++) {
|
||||||
var parsedRule = parsedRules[i];
|
var parsedRule = parsedRules[i];
|
||||||
var rule: StringMap<string, any> = StringMapWrapper.create();
|
var rule: {[key: string]: any} = StringMapWrapper.create();
|
||||||
StringMapWrapper.set(rule, "cssText", css);
|
StringMapWrapper.set(rule, "cssText", css);
|
||||||
StringMapWrapper.set(rule, "style", {content: "", cssText: ""});
|
StringMapWrapper.set(rule, "style", {content: "", cssText: ""});
|
||||||
if (parsedRule.type == "rule") {
|
if (parsedRule.type == "rule") {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
|
|
||||||
export var Map = global.Map;
|
export var Map = global.Map;
|
||||||
export var Set = global.Set;
|
export var Set = global.Set;
|
||||||
export var StringMap = global.Object;
|
|
||||||
|
|
||||||
// Safari and Internet Explorer do not support the iterable parameter to the
|
// Safari and Internet Explorer do not support the iterable parameter to the
|
||||||
// Map constructor. We work around that by manually adding the items.
|
// Map constructor. We work around that by manually adding the items.
|
||||||
|
@ -79,14 +78,14 @@ var _arrayFromMap: {(m: Map<any, any>, getValues: boolean): any[]} = (function()
|
||||||
|
|
||||||
export class MapWrapper {
|
export class MapWrapper {
|
||||||
static clone<K, V>(m: Map<K, V>): Map<K, V> { return createMapFromMap(m); }
|
static clone<K, V>(m: Map<K, V>): Map<K, V> { return createMapFromMap(m); }
|
||||||
static createFromStringMap<T>(stringMap: StringMap<string, T>): Map<string, T> {
|
static createFromStringMap<T>(stringMap: {[key: string]: T}): Map<string, T> {
|
||||||
var result = new Map<string, T>();
|
var result = new Map<string, T>();
|
||||||
for (var prop in stringMap) {
|
for (var prop in stringMap) {
|
||||||
result.set(prop, stringMap[prop]);
|
result.set(prop, stringMap[prop]);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
static toStringMap<T>(m: Map<string, T>): StringMap<string, T> {
|
static toStringMap<T>(m: Map<string, T>): {[key: string]: T} {
|
||||||
var r = {};
|
var r = {};
|
||||||
m.forEach((v, k) => r[k] = v);
|
m.forEach((v, k) => r[k] = v);
|
||||||
return r;
|
return r;
|
||||||
|
@ -106,28 +105,28 @@ export class MapWrapper {
|
||||||
* Wraps Javascript Objects
|
* Wraps Javascript Objects
|
||||||
*/
|
*/
|
||||||
export class StringMapWrapper {
|
export class StringMapWrapper {
|
||||||
static create(): StringMap<any, any> {
|
static create(): {[k: /*any*/ string]: any} {
|
||||||
// Note: We are not using Object.create(null) here due to
|
// Note: We are not using Object.create(null) here due to
|
||||||
// performance!
|
// performance!
|
||||||
// http://jsperf.com/ng2-object-create-null
|
// http://jsperf.com/ng2-object-create-null
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
static contains(map: StringMap<string, any>, key: string): boolean {
|
static contains(map: {[key: string]: any}, key: string): boolean {
|
||||||
return map.hasOwnProperty(key);
|
return map.hasOwnProperty(key);
|
||||||
}
|
}
|
||||||
static get<V>(map: StringMap<string, V>, key: string): V {
|
static get<V>(map: {[key: string]: V}, key: string): V {
|
||||||
return map.hasOwnProperty(key) ? map[key] : undefined;
|
return map.hasOwnProperty(key) ? map[key] : undefined;
|
||||||
}
|
}
|
||||||
static set<V>(map: StringMap<string, V>, key: string, value: V) { map[key] = value; }
|
static set<V>(map: {[key: string]: V}, key: string, value: V) { map[key] = value; }
|
||||||
static keys(map: StringMap<string, any>): string[] { return Object.keys(map); }
|
static keys(map: {[key: string]: any}): string[] { return Object.keys(map); }
|
||||||
static isEmpty(map: StringMap<string, any>): boolean {
|
static isEmpty(map: {[key: string]: any}): boolean {
|
||||||
for (var prop in map) {
|
for (var prop in map) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static delete (map: StringMap<string, any>, key: string) { delete map[key]; }
|
static delete (map: {[key: string]: any}, key: string) { delete map[key]; }
|
||||||
static forEach<K, V>(map: StringMap<string, V>, callback: /*(V, K) => void*/ Function) {
|
static forEach<K, V>(map: {[key: string]: V}, callback: /*(V, K) => void*/ Function) {
|
||||||
for (var prop in map) {
|
for (var prop in map) {
|
||||||
if (map.hasOwnProperty(prop)) {
|
if (map.hasOwnProperty(prop)) {
|
||||||
callback(map[prop], prop);
|
callback(map[prop], prop);
|
||||||
|
@ -135,7 +134,7 @@ export class StringMapWrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static merge<V>(m1: StringMap<string, V>, m2: StringMap<string, V>): StringMap<string, V> {
|
static merge<V>(m1: {[key: string]: V}, m2: {[key: string]: V}): {[key: string]: V} {
|
||||||
var m = {};
|
var m = {};
|
||||||
|
|
||||||
for (var attr in m1) {
|
for (var attr in m1) {
|
||||||
|
@ -153,7 +152,7 @@ export class StringMapWrapper {
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
static equals<V>(m1: StringMap<string, V>, m2: StringMap<string, V>): boolean {
|
static equals<V>(m1: {[key: string]: V}, m2: {[key: string]: V}): boolean {
|
||||||
var k1 = Object.keys(m1);
|
var k1 = Object.keys(m1);
|
||||||
var k2 = Object.keys(m2);
|
var k2 = Object.keys(m2);
|
||||||
if (k1.length != k2.length) {
|
if (k1.length != k2.length) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ export class AbstractControlDirective {
|
||||||
|
|
||||||
get valid(): boolean { return isPresent(this.control) ? this.control.valid : null; }
|
get valid(): boolean { return isPresent(this.control) ? this.control.valid : null; }
|
||||||
|
|
||||||
get errors(): StringMap<string, any> {
|
get errors(): {[key: string]: any} {
|
||||||
return isPresent(this.control) ? this.control.errors : null;
|
return isPresent(this.control) ? this.control.errors : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,4 +19,4 @@ export class AbstractControlDirective {
|
||||||
get touched(): boolean { return isPresent(this.control) ? this.control.touched : null; }
|
get touched(): boolean { return isPresent(this.control) ? this.control.touched : null; }
|
||||||
|
|
||||||
get untouched(): boolean { return isPresent(this.control) ? this.control.untouched : null; }
|
get untouched(): boolean { return isPresent(this.control) ? this.control.untouched : null; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import {CONST_EXPR} from 'angular2/src/core/facade/lang';
|
import {CONST_EXPR} from 'angular2/src/core/facade/lang';
|
||||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async';
|
import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {StringMap} from 'angular2/src/core/facade/collection';
|
|
||||||
import {OnChanges, OnDestroy} from 'angular2/lifecycle_hooks';
|
import {OnChanges, OnDestroy} from 'angular2/lifecycle_hooks';
|
||||||
import {SimpleChange} from 'angular2/src/core/change_detection';
|
import {SimpleChange} from 'angular2/src/core/change_detection';
|
||||||
import {Query, Directive} from 'angular2/src/core/metadata';
|
import {Query, Directive} from 'angular2/src/core/metadata';
|
||||||
|
@ -97,7 +96,7 @@ export class NgControlName extends NgControl implements OnChanges,
|
||||||
this.valueAccessor = selectValueAccessor(this, valueAccessors);
|
this.valueAccessor = selectValueAccessor(this, valueAccessors);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChanges(changes: StringMap<string, SimpleChange>) {
|
onChanges(changes: {[key: string]: SimpleChange}) {
|
||||||
if (!this._added) {
|
if (!this._added) {
|
||||||
this.formDirective.addControl(this);
|
this.formDirective.addControl(this);
|
||||||
this._added = true;
|
this._added = true;
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class NgForm extends ControlContainer implements Form {
|
||||||
|
|
||||||
get path(): string[] { return []; }
|
get path(): string[] { return []; }
|
||||||
|
|
||||||
get controls(): StringMap<string, AbstractControl> { return this.form.controls; }
|
get controls(): {[key: string]: AbstractControl} { return this.form.controls; }
|
||||||
|
|
||||||
addControl(dir: NgControl): void {
|
addControl(dir: NgControl): void {
|
||||||
this._later(_ => {
|
this._later(_ => {
|
||||||
|
|
|
@ -84,7 +84,7 @@ export class NgFormControl extends NgControl implements OnChanges {
|
||||||
this.valueAccessor = selectValueAccessor(this, valueAccessors);
|
this.valueAccessor = selectValueAccessor(this, valueAccessors);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChanges(changes: StringMap<string, SimpleChange>): void {
|
onChanges(changes: {[key: string]: SimpleChange}): void {
|
||||||
if (!this._added) {
|
if (!this._added) {
|
||||||
setUpControl(this.form, this);
|
setUpControl(this.form, this);
|
||||||
this.form.updateValidity();
|
this.form.updateValidity();
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class NgModel extends NgControl implements OnChanges {
|
||||||
this.valueAccessor = selectValueAccessor(this, valueAccessors);
|
this.valueAccessor = selectValueAccessor(this, valueAccessors);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChanges(changes: StringMap<string, SimpleChange>) {
|
onChanges(changes: {[key: string]: SimpleChange}) {
|
||||||
if (!this._added) {
|
if (!this._added) {
|
||||||
setUpControl(this._control, this);
|
setUpControl(this._control, this);
|
||||||
this._control.updateValidity();
|
this._control.updateValidity();
|
||||||
|
|
|
@ -51,7 +51,7 @@ export function setProperty(renderer: Renderer, elementRef: ElementRef, propName
|
||||||
renderer.setElementProperty(elementRef, propName, propValue);
|
renderer.setElementProperty(elementRef, propName, propValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPropertyUpdated(changes: StringMap<string, any>, viewModel: any): boolean {
|
export function isPropertyUpdated(changes: {[key: string]: any}, viewModel: any): boolean {
|
||||||
if (!StringMapWrapper.contains(changes, "model")) return false;
|
if (!StringMapWrapper.contains(changes, "model")) return false;
|
||||||
var change = changes["model"];
|
var change = changes["model"];
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ import * as modelModule from './model';
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FormBuilder {
|
export class FormBuilder {
|
||||||
group(controlsConfig: StringMap<string, any>,
|
group(controlsConfig: {[key: string]: any},
|
||||||
extra: StringMap<string, any> = null): modelModule.ControlGroup {
|
extra: {[key: string]: any} = null): modelModule.ControlGroup {
|
||||||
var controls = this._reduceControls(controlsConfig);
|
var controls = this._reduceControls(controlsConfig);
|
||||||
var optionals = isPresent(extra) ? StringMapWrapper.get(extra, "optionals") : null;
|
var optionals = isPresent(extra) ? StringMapWrapper.get(extra, "optionals") : null;
|
||||||
var validator = isPresent(extra) ? StringMapWrapper.get(extra, "validator") : null;
|
var validator = isPresent(extra) ? StringMapWrapper.get(extra, "validator") : null;
|
||||||
|
@ -96,7 +96,7 @@ export class FormBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_reduceControls(controlsConfig: any): StringMap<string, modelModule.AbstractControl> {
|
_reduceControls(controlsConfig: any): {[key: string]: modelModule.AbstractControl} {
|
||||||
var controls = {};
|
var controls = {};
|
||||||
StringMapWrapper.forEach(controlsConfig, (controlConfig, controlName) => {
|
StringMapWrapper.forEach(controlsConfig, (controlConfig, controlName) => {
|
||||||
controls[controlName] = this._createControl(controlConfig);
|
controls[controlName] = this._createControl(controlConfig);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {StringWrapper, isPresent, isBlank, normalizeBool} from 'angular2/src/core/facade/lang';
|
import {StringWrapper, isPresent, isBlank, normalizeBool} from 'angular2/src/core/facade/lang';
|
||||||
import {Observable, EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async';
|
import {Observable, EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {StringMap, StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {Validators} from './validators';
|
import {Validators} from './validators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ function _find(control: AbstractControl, path: Array<string | number>| string) {
|
||||||
export class AbstractControl {
|
export class AbstractControl {
|
||||||
_value: any;
|
_value: any;
|
||||||
_status: string;
|
_status: string;
|
||||||
_errors: StringMap<string, any>;
|
_errors: {[key: string]: any};
|
||||||
_pristine: boolean = true;
|
_pristine: boolean = true;
|
||||||
_touched: boolean = false;
|
_touched: boolean = false;
|
||||||
_parent: ControlGroup | ControlArray;
|
_parent: ControlGroup | ControlArray;
|
||||||
|
@ -58,7 +58,7 @@ export class AbstractControl {
|
||||||
|
|
||||||
get valid(): boolean { return this._status === VALID; }
|
get valid(): boolean { return this._status === VALID; }
|
||||||
|
|
||||||
get errors(): StringMap<string, any> { return this._errors; }
|
get errors(): {[key: string]: any} { return this._errors; }
|
||||||
|
|
||||||
get pristine(): boolean { return this._pristine; }
|
get pristine(): boolean { return this._pristine; }
|
||||||
|
|
||||||
|
@ -199,11 +199,10 @@ export class Control extends AbstractControl {
|
||||||
* ### Example ([live demo](http://plnkr.co/edit/23DESOpbNnBpBHZt1BR4?p=preview))
|
* ### Example ([live demo](http://plnkr.co/edit/23DESOpbNnBpBHZt1BR4?p=preview))
|
||||||
*/
|
*/
|
||||||
export class ControlGroup extends AbstractControl {
|
export class ControlGroup extends AbstractControl {
|
||||||
private _optionals: StringMap<string, boolean>;
|
private _optionals: {[key: string]: boolean};
|
||||||
|
|
||||||
constructor(public controls: StringMap<string, AbstractControl>,
|
constructor(public controls: {[key: string]: AbstractControl},
|
||||||
optionals: StringMap<string, boolean> = null,
|
optionals: {[key: string]: boolean} = null, validator: Function = Validators.group) {
|
||||||
validator: Function = Validators.group) {
|
|
||||||
super(validator);
|
super(validator);
|
||||||
this._optionals = isPresent(optionals) ? optionals : {};
|
this._optionals = isPresent(optionals) ? optionals : {};
|
||||||
this._valueChanges = new EventEmitter();
|
this._valueChanges = new EventEmitter();
|
||||||
|
|
|
@ -17,11 +17,11 @@ export const NG_VALIDATORS: OpaqueToken = CONST_EXPR(new OpaqueToken("NgValidato
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export class Validators {
|
export class Validators {
|
||||||
static required(control: modelModule.Control): StringMap<string, boolean> {
|
static required(control: modelModule.Control): {[key: string]: boolean} {
|
||||||
return isBlank(control.value) || control.value == "" ? {"required": true} : null;
|
return isBlank(control.value) || control.value == "" ? {"required": true} : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nullValidator(c: any): StringMap<string, boolean> { return null; }
|
static nullValidator(c: any): {[key: string]: boolean} { return null; }
|
||||||
|
|
||||||
static compose(validators: Function[]): Function {
|
static compose(validators: Function[]): Function {
|
||||||
if (isBlank(validators)) return Validators.nullValidator;
|
if (isBlank(validators)) return Validators.nullValidator;
|
||||||
|
@ -35,7 +35,7 @@ export class Validators {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static group(group: modelModule.ControlGroup): StringMap<string, boolean> {
|
static group(group: modelModule.ControlGroup): {[key: string]: boolean} {
|
||||||
var res = {};
|
var res = {};
|
||||||
StringMapWrapper.forEach(group.controls, (control, name) => {
|
StringMapWrapper.forEach(group.controls, (control, name) => {
|
||||||
if (group.contains(name) && isPresent(control.errors)) {
|
if (group.contains(name) && isPresent(control.errors)) {
|
||||||
|
@ -45,7 +45,7 @@ export class Validators {
|
||||||
return StringMapWrapper.isEmpty(res) ? null : res;
|
return StringMapWrapper.isEmpty(res) ? null : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static array(array: modelModule.ControlArray): StringMap<string, boolean> {
|
static array(array: modelModule.ControlArray): {[key: string]: boolean} {
|
||||||
var res = {};
|
var res = {};
|
||||||
array.controls.forEach((control) => {
|
array.controls.forEach((control) => {
|
||||||
if (isPresent(control.errors)) {
|
if (isPresent(control.errors)) {
|
||||||
|
@ -55,7 +55,7 @@ export class Validators {
|
||||||
return StringMapWrapper.isEmpty(res) ? null : res;
|
return StringMapWrapper.isEmpty(res) ? null : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static _mergeErrors(control: modelModule.AbstractControl, res: StringMap<string, any[]>): void {
|
static _mergeErrors(control: modelModule.AbstractControl, res: {[key: string]: any[]}): void {
|
||||||
StringMapWrapper.forEach(control.errors, (value, error) => {
|
StringMapWrapper.forEach(control.errors, (value, error) => {
|
||||||
if (!StringMapWrapper.contains(res, error)) {
|
if (!StringMapWrapper.contains(res, error)) {
|
||||||
res[error] = [];
|
res[error] = [];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {resolveForwardRef, Injectable} from 'angular2/src/core/di';
|
import {resolveForwardRef, Injectable} from 'angular2/src/core/di';
|
||||||
import {Type, isPresent, isBlank, stringify} from 'angular2/src/core/facade/lang';
|
import {Type, isPresent, isBlank, stringify} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {ListWrapper, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {
|
import {
|
||||||
DirectiveMetadata,
|
DirectiveMetadata,
|
||||||
ComponentMetadata,
|
ComponentMetadata,
|
||||||
|
@ -43,8 +43,7 @@ export class DirectiveResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _mergeWithPropertyMetadata(dm: DirectiveMetadata,
|
private _mergeWithPropertyMetadata(dm: DirectiveMetadata,
|
||||||
propertyMetadata:
|
propertyMetadata: {[key: string]: any[]}): DirectiveMetadata {
|
||||||
StringMap<string, any[]>): DirectiveMetadata {
|
|
||||||
var inputs = [];
|
var inputs = [];
|
||||||
var outputs = [];
|
var outputs = [];
|
||||||
var host = {};
|
var host = {};
|
||||||
|
@ -102,8 +101,7 @@ export class DirectiveResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _merge(dm: DirectiveMetadata, inputs: string[], outputs: string[],
|
private _merge(dm: DirectiveMetadata, inputs: string[], outputs: string[],
|
||||||
host: StringMap<string, string>,
|
host: {[key: string]: string}, queries: {[key: string]: any}): DirectiveMetadata {
|
||||||
queries: StringMap<string, any>): DirectiveMetadata {
|
|
||||||
var mergedInputs = isPresent(dm.inputs) ? ListWrapper.concat(dm.inputs, inputs) : inputs;
|
var mergedInputs = isPresent(dm.inputs) ? ListWrapper.concat(dm.inputs, inputs) : inputs;
|
||||||
var mergedOutputs = isPresent(dm.outputs) ? ListWrapper.concat(dm.outputs, outputs) : outputs;
|
var mergedOutputs = isPresent(dm.outputs) ? ListWrapper.concat(dm.outputs, outputs) : outputs;
|
||||||
var mergedHost = isPresent(dm.host) ? StringMapWrapper.merge(dm.host, host) : host;
|
var mergedHost = isPresent(dm.host) ? StringMapWrapper.merge(dm.host, host) : host;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {StringMap, MapWrapper} from 'angular2/src/core/facade/collection';
|
import {MapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {SimpleChange} from 'angular2/src/core/change_detection/change_detection_util';
|
import {SimpleChange} from 'angular2/src/core/change_detection/change_detection_util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +77,7 @@ export var LIFECYCLE_HOOKS_VALUES = [
|
||||||
* bootstrap(App).catch(err => console.error(err));
|
* bootstrap(App).catch(err => console.error(err));
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export interface OnChanges { onChanges(changes: StringMap<string, SimpleChange>); }
|
export interface OnChanges { onChanges(changes: {[key: string]: SimpleChange}); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement this interface to execute custom initialization logic after your directive's
|
* Implement this interface to execute custom initialization logic after your directive's
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {
|
||||||
MapWrapper,
|
MapWrapper,
|
||||||
Map,
|
Map,
|
||||||
StringMapWrapper,
|
StringMapWrapper,
|
||||||
StringMap
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
} from 'angular2/src/core/facade/collection';
|
||||||
import {
|
import {
|
||||||
AST,
|
AST,
|
||||||
|
@ -263,7 +262,7 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher {
|
||||||
get ownBindersCount(): number { return this.proto.elementBinders.length; }
|
get ownBindersCount(): number { return this.proto.elementBinders.length; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _localsToStringMap(locals: Locals): StringMap<string, any> {
|
function _localsToStringMap(locals: Locals): {[key: string]: any} {
|
||||||
var res = {};
|
var res = {};
|
||||||
var c = locals;
|
var c = locals;
|
||||||
while (isPresent(c)) {
|
while (isPresent(c)) {
|
||||||
|
@ -339,4 +338,4 @@ export class AppProtoView {
|
||||||
}
|
}
|
||||||
|
|
||||||
isInitialized(): boolean { return isPresent(this.elementBinders); }
|
isInitialized(): boolean { return isPresent(this.elementBinders); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,11 +151,11 @@ export interface DirectiveFactory {
|
||||||
outputs?: string[],
|
outputs?: string[],
|
||||||
properties?: string[],
|
properties?: string[],
|
||||||
events?: string[],
|
events?: string[],
|
||||||
host?: StringMap<string, string>,
|
host?: {[key: string]: string},
|
||||||
bindings?: any[],
|
bindings?: any[],
|
||||||
exportAs?: string,
|
exportAs?: string,
|
||||||
moduleId?: string,
|
moduleId?: string,
|
||||||
queries?: StringMap<string, any>
|
queries?: {[key: string]: any}
|
||||||
}): DirectiveDecorator;
|
}): DirectiveDecorator;
|
||||||
new (obj: {
|
new (obj: {
|
||||||
selector?: string,
|
selector?: string,
|
||||||
|
@ -163,11 +163,11 @@ export interface DirectiveFactory {
|
||||||
outputs?: string[],
|
outputs?: string[],
|
||||||
properties?: string[],
|
properties?: string[],
|
||||||
events?: string[],
|
events?: string[],
|
||||||
host?: StringMap<string, string>,
|
host?: {[key: string]: string},
|
||||||
bindings?: any[],
|
bindings?: any[],
|
||||||
exportAs?: string,
|
exportAs?: string,
|
||||||
moduleId?: string,
|
moduleId?: string,
|
||||||
queries?: StringMap<string, any>
|
queries?: {[key: string]: any}
|
||||||
}): DirectiveMetadata;
|
}): DirectiveMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,11 +221,11 @@ export interface ComponentFactory {
|
||||||
outputs?: string[],
|
outputs?: string[],
|
||||||
properties?: string[],
|
properties?: string[],
|
||||||
events?: string[],
|
events?: string[],
|
||||||
host?: StringMap<string, string>,
|
host?: {[key: string]: string},
|
||||||
bindings?: any[],
|
bindings?: any[],
|
||||||
exportAs?: string,
|
exportAs?: string,
|
||||||
moduleId?: string,
|
moduleId?: string,
|
||||||
queries?: StringMap<string, any>,
|
queries?: {[key: string]: any},
|
||||||
viewBindings?: any[],
|
viewBindings?: any[],
|
||||||
changeDetection?: ChangeDetectionStrategy,
|
changeDetection?: ChangeDetectionStrategy,
|
||||||
}): ComponentDecorator;
|
}): ComponentDecorator;
|
||||||
|
@ -235,11 +235,11 @@ export interface ComponentFactory {
|
||||||
outputs?: string[],
|
outputs?: string[],
|
||||||
properties?: string[],
|
properties?: string[],
|
||||||
events?: string[],
|
events?: string[],
|
||||||
host?: StringMap<string, string>,
|
host?: {[key: string]: string},
|
||||||
bindings?: any[],
|
bindings?: any[],
|
||||||
exportAs?: string,
|
exportAs?: string,
|
||||||
moduleId?: string,
|
moduleId?: string,
|
||||||
queries?: StringMap<string, any>,
|
queries?: {[key: string]: any},
|
||||||
viewBindings?: any[],
|
viewBindings?: any[],
|
||||||
changeDetection?: ChangeDetectionStrategy,
|
changeDetection?: ChangeDetectionStrategy,
|
||||||
}): ComponentMetadata;
|
}): ComponentMetadata;
|
||||||
|
|
|
@ -632,7 +632,7 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
host: StringMap<string, string>;
|
host: {[key: string]: string};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the set of injectable objects that are visible to a Directive and its light DOM
|
* Defines the set of injectable objects that are visible to a Directive and its light DOM
|
||||||
|
@ -748,7 +748,7 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
queries: StringMap<string, any>;
|
queries: {[key: string]: any};
|
||||||
|
|
||||||
constructor({selector, inputs, outputs, properties, events, host, bindings, exportAs, moduleId,
|
constructor({selector, inputs, outputs, properties, events, host, bindings, exportAs, moduleId,
|
||||||
queries}: {
|
queries}: {
|
||||||
|
@ -757,11 +757,11 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||||
outputs?: string[],
|
outputs?: string[],
|
||||||
properties?: string[],
|
properties?: string[],
|
||||||
events?: string[],
|
events?: string[],
|
||||||
host?: StringMap<string, string>,
|
host?: {[key: string]: string},
|
||||||
bindings?: any[],
|
bindings?: any[],
|
||||||
exportAs?: string,
|
exportAs?: string,
|
||||||
moduleId?: string,
|
moduleId?: string,
|
||||||
queries?: StringMap<string, any>
|
queries?: {[key: string]: any}
|
||||||
} = {}) {
|
} = {}) {
|
||||||
super();
|
super();
|
||||||
this.selector = selector;
|
this.selector = selector;
|
||||||
|
@ -883,12 +883,12 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||||
outputs?: string[],
|
outputs?: string[],
|
||||||
properties?: string[],
|
properties?: string[],
|
||||||
events?: string[],
|
events?: string[],
|
||||||
host?: StringMap<string, string>,
|
host?: {[key: string]: string},
|
||||||
bindings?: any[],
|
bindings?: any[],
|
||||||
exportAs?: string,
|
exportAs?: string,
|
||||||
moduleId?: string,
|
moduleId?: string,
|
||||||
viewBindings?: any[],
|
viewBindings?: any[],
|
||||||
queries?: StringMap<string, any>,
|
queries?: {[key: string]: any},
|
||||||
changeDetection?: ChangeDetectionStrategy,
|
changeDetection?: ChangeDetectionStrategy,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
super({
|
super({
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class ProtoPipes {
|
||||||
/**
|
/**
|
||||||
* Map of {@link PipeMetadata} names to {@link PipeMetadata} implementations.
|
* Map of {@link PipeMetadata} names to {@link PipeMetadata} implementations.
|
||||||
*/
|
*/
|
||||||
public config: StringMap<string, PipeBinding>) {
|
public config: {[key: string]: PipeBinding}) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ export class ProtoPipes {
|
||||||
|
|
||||||
|
|
||||||
export class Pipes implements cd.Pipes {
|
export class Pipes implements cd.Pipes {
|
||||||
_config: StringMap<string, cd.SelectedPipe> = {};
|
_config: {[key: string]: cd.SelectedPipe} = {};
|
||||||
|
|
||||||
constructor(public proto: ProtoPipes, public injector: Injector) {}
|
constructor(public proto: ProtoPipes, public injector: Injector) {}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ export interface PlatformReflectionCapabilities {
|
||||||
interfaces(type: Type): any[];
|
interfaces(type: Type): any[];
|
||||||
parameters(type: any): any[][];
|
parameters(type: any): any[][];
|
||||||
annotations(type: any): any[];
|
annotations(type: any): any[];
|
||||||
propMetadata(typeOrFunc: any): StringMap<string, any[]>;
|
propMetadata(typeOrFunc: any): {[key: string]: any[]};
|
||||||
getter(name: string): GetterFn;
|
getter(name: string): GetterFn;
|
||||||
setter(name: string): SetterFn;
|
setter(name: string): SetterFn;
|
||||||
method(name: string): MethodFn;
|
method(name: string): MethodFn;
|
||||||
|
|
|
@ -134,7 +134,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
propMetadata(typeOrFunc: any): StringMap<string, any[]> {
|
propMetadata(typeOrFunc: any): {[key: string]: any[]} {
|
||||||
// Prefer the direct API.
|
// Prefer the direct API.
|
||||||
if (isPresent((<any>typeOrFunc).propMetadata)) {
|
if (isPresent((<any>typeOrFunc).propMetadata)) {
|
||||||
var propMetadata = (<any>typeOrFunc).propMetadata;
|
var propMetadata = (<any>typeOrFunc).propMetadata;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {
|
||||||
MapWrapper,
|
MapWrapper,
|
||||||
Set,
|
Set,
|
||||||
SetWrapper,
|
SetWrapper,
|
||||||
StringMap,
|
|
||||||
StringMapWrapper
|
StringMapWrapper
|
||||||
} from 'angular2/src/core/facade/collection';
|
} from 'angular2/src/core/facade/collection';
|
||||||
import {SetterFn, GetterFn, MethodFn} from './types';
|
import {SetterFn, GetterFn, MethodFn} from './types';
|
||||||
|
@ -16,7 +15,7 @@ export {PlatformReflectionCapabilities} from './platform_reflection_capabilities
|
||||||
|
|
||||||
export class ReflectionInfo {
|
export class ReflectionInfo {
|
||||||
constructor(public annotations?: any[], public parameters?: any[][], public factory?: Function,
|
constructor(public annotations?: any[], public parameters?: any[][], public factory?: Function,
|
||||||
public interfaces?: any[], public propMetadata?: StringMap<string, any[]>) {}
|
public interfaces?: any[], public propMetadata?: {[key: string]: any[]}) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Reflector {
|
export class Reflector {
|
||||||
|
@ -61,17 +60,11 @@ export class Reflector {
|
||||||
this._injectableInfo.set(type, typeInfo);
|
this._injectableInfo.set(type, typeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerGetters(getters: StringMap<string, GetterFn>): void {
|
registerGetters(getters: {[key: string]: GetterFn}): void { _mergeMaps(this._getters, getters); }
|
||||||
_mergeMaps(this._getters, getters);
|
|
||||||
}
|
|
||||||
|
|
||||||
registerSetters(setters: StringMap<string, SetterFn>): void {
|
registerSetters(setters: {[key: string]: SetterFn}): void { _mergeMaps(this._setters, setters); }
|
||||||
_mergeMaps(this._setters, setters);
|
|
||||||
}
|
|
||||||
|
|
||||||
registerMethods(methods: StringMap<string, MethodFn>): void {
|
registerMethods(methods: {[key: string]: MethodFn}): void { _mergeMaps(this._methods, methods); }
|
||||||
_mergeMaps(this._methods, methods);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory(type: Type): Function {
|
factory(type: Type): Function {
|
||||||
if (this._containsReflectionInfo(type)) {
|
if (this._containsReflectionInfo(type)) {
|
||||||
|
@ -100,7 +93,7 @@ export class Reflector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
propMetadata(typeOrFunc: /*Type*/ any): StringMap<string, any[]> {
|
propMetadata(typeOrFunc: /*Type*/ any): {[key: string]: any[]} {
|
||||||
if (this._injectableInfo.has(typeOrFunc)) {
|
if (this._injectableInfo.has(typeOrFunc)) {
|
||||||
var res = this._getReflectionInfo(typeOrFunc).propMetadata;
|
var res = this._getReflectionInfo(typeOrFunc).propMetadata;
|
||||||
return isPresent(res) ? res : {};
|
return isPresent(res) ? res : {};
|
||||||
|
@ -154,6 +147,6 @@ export class Reflector {
|
||||||
importUri(type: Type): string { return this.reflectionCapabilities.importUri(type); }
|
importUri(type: Type): string { return this.reflectionCapabilities.importUri(type); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _mergeMaps(target: Map<any, any>, config: StringMap<string, Function>): void {
|
function _mergeMaps(target: Map<any, any>, config: {[key: string]: Function}): void {
|
||||||
StringMapWrapper.forEach(config, (v, k) => target.set(k, v));
|
StringMapWrapper.forEach(config, (v, k) => target.set(k, v));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||||
import {Injectable} from 'angular2/src/core/di';
|
import {Injectable} from 'angular2/src/core/di';
|
||||||
|
|
||||||
var modifierKeys = ['alt', 'control', 'meta', 'shift'];
|
var modifierKeys = ['alt', 'control', 'meta', 'shift'];
|
||||||
var modifierKeyGetters: StringMap<string, Function> = {
|
var modifierKeyGetters: {[key: string]: Function} = {
|
||||||
'alt': (event) => event.altKey,
|
'alt': (event) => event.altKey,
|
||||||
'control': (event) => event.ctrlKey,
|
'control': (event) => event.ctrlKey,
|
||||||
'meta': (event) => event.metaKey,
|
'meta': (event) => event.metaKey,
|
||||||
|
@ -38,7 +38,7 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static parseEventName(eventName: string): StringMap<string, string> {
|
static parseEventName(eventName: string): {[key: string]: string} {
|
||||||
var parts = eventName.toLowerCase().split('.');
|
var parts = eventName.toLowerCase().split('.');
|
||||||
|
|
||||||
var domEventName = ListWrapper.removeAt(parts, 0);
|
var domEventName = ListWrapper.removeAt(parts, 0);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supported http methods.
|
* Supported http methods.
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
Map,
|
Map,
|
||||||
MapWrapper,
|
MapWrapper,
|
||||||
ListWrapper,
|
ListWrapper,
|
||||||
StringMap
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +35,7 @@ import {
|
||||||
*/
|
*/
|
||||||
export class Headers {
|
export class Headers {
|
||||||
_headersMap: Map<string, string[]>;
|
_headersMap: Map<string, string[]>;
|
||||||
constructor(headers?: Headers | StringMap<string, any>) {
|
constructor(headers?: Headers | {[key: string]: any}) {
|
||||||
if (isBlank(headers)) {
|
if (isBlank(headers)) {
|
||||||
this._headersMap = new Map<string, string[]>();
|
this._headersMap = new Map<string, string[]>();
|
||||||
return;
|
return;
|
||||||
|
@ -44,7 +43,7 @@ export class Headers {
|
||||||
|
|
||||||
if (headers instanceof Headers) {
|
if (headers instanceof Headers) {
|
||||||
this._headersMap = (<Headers>headers)._headersMap;
|
this._headersMap = (<Headers>headers)._headersMap;
|
||||||
} else if (headers instanceof StringMap) {
|
} else /*if (headers instanceof StringMap)*/ {
|
||||||
this._headersMap = MapWrapper.createFromStringMap<string[]>(headers);
|
this._headersMap = MapWrapper.createFromStringMap<string[]>(headers);
|
||||||
MapWrapper.forEach(this._headersMap, (v, k) => {
|
MapWrapper.forEach(this._headersMap, (v, k) => {
|
||||||
if (!isListLikeIterable(v)) {
|
if (!isListLikeIterable(v)) {
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
import {
|
import {Map, MapWrapper, StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
Map,
|
|
||||||
MapWrapper,
|
|
||||||
StringMap,
|
|
||||||
StringMapWrapper,
|
|
||||||
ListWrapper
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
|
||||||
import {isPresent, isBlank, normalizeBlank, Type} from 'angular2/src/core/facade/lang';
|
import {isPresent, isBlank, normalizeBlank, Type} from 'angular2/src/core/facade/lang';
|
||||||
import {Promise} from 'angular2/src/core/facade/async';
|
import {Promise} from 'angular2/src/core/facade/async';
|
||||||
|
|
||||||
|
@ -43,7 +37,7 @@ import {Url} from './url_parser';
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export class RouteParams {
|
export class RouteParams {
|
||||||
constructor(public params: StringMap<string, string>) {}
|
constructor(public params: {[key: string]: string}) {}
|
||||||
|
|
||||||
get(param: string): string { return normalizeBlank(StringMapWrapper.get(this.params, param)); }
|
get(param: string): string { return normalizeBlank(StringMapWrapper.get(this.params, param)); }
|
||||||
}
|
}
|
||||||
|
@ -78,7 +72,7 @@ export class RouteParams {
|
||||||
*/
|
*/
|
||||||
export class Instruction {
|
export class Instruction {
|
||||||
constructor(public component: ComponentInstruction, public child: Instruction,
|
constructor(public component: ComponentInstruction, public child: Instruction,
|
||||||
public auxInstruction: StringMap<string, Instruction>) {}
|
public auxInstruction: {[key: string]: Instruction}) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new instruction that shares the state of the existing instruction, but with
|
* Returns a new instruction that shares the state of the existing instruction, but with
|
||||||
|
@ -153,7 +147,7 @@ export class ComponentInstruction {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
constructor(public urlPath: string, public urlParams: string[],
|
constructor(public urlPath: string, public urlParams: string[],
|
||||||
private _recognizer: PathRecognizer, public params: StringMap<string, any> = null) {}
|
private _recognizer: PathRecognizer, public params: {[key: string]: any} = null) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the component type of the represented route, or `null` if this instruction
|
* Returns the component type of the represented route, or `null` if this instruction
|
||||||
|
|
|
@ -8,23 +8,17 @@ import {
|
||||||
} from 'angular2/src/core/facade/lang';
|
} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
|
|
||||||
import {
|
import {Map, MapWrapper, StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
Map,
|
|
||||||
MapWrapper,
|
|
||||||
StringMap,
|
|
||||||
StringMapWrapper,
|
|
||||||
ListWrapper
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
import {RouteHandler} from './route_handler';
|
import {RouteHandler} from './route_handler';
|
||||||
import {Url, RootUrl, serializeParams} from './url_parser';
|
import {Url, RootUrl, serializeParams} from './url_parser';
|
||||||
import {ComponentInstruction} from './instruction';
|
import {ComponentInstruction} from './instruction';
|
||||||
|
|
||||||
class TouchMap {
|
class TouchMap {
|
||||||
map: StringMap<string, string> = {};
|
map: {[key: string]: string} = {};
|
||||||
keys: StringMap<string, boolean> = {};
|
keys: {[key: string]: boolean} = {};
|
||||||
|
|
||||||
constructor(map: StringMap<string, any>) {
|
constructor(map: {[key: string]: any}) {
|
||||||
if (isPresent(map)) {
|
if (isPresent(map)) {
|
||||||
StringMapWrapper.forEach(map, (value, key) => {
|
StringMapWrapper.forEach(map, (value, key) => {
|
||||||
this.map[key] = isPresent(value) ? value.toString() : null;
|
this.map[key] = isPresent(value) ? value.toString() : null;
|
||||||
|
@ -38,8 +32,8 @@ class TouchMap {
|
||||||
return this.map[key];
|
return this.map[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
getUnused(): StringMap<string, any> {
|
getUnused(): {[key: string]: any} {
|
||||||
var unused: StringMap<string, any> = StringMapWrapper.create();
|
var unused: {[key: string]: any} = StringMapWrapper.create();
|
||||||
var keys = StringMapWrapper.keys(this.keys);
|
var keys = StringMapWrapper.keys(this.keys);
|
||||||
ListWrapper.forEach(keys, (key) => { unused[key] = StringMapWrapper.get(this.map, key); });
|
ListWrapper.forEach(keys, (key) => { unused[key] = StringMapWrapper.get(this.map, key); });
|
||||||
return unused;
|
return unused;
|
||||||
|
@ -96,7 +90,7 @@ class StarSegment implements Segment {
|
||||||
var paramMatcher = /^:([^\/]+)$/g;
|
var paramMatcher = /^:([^\/]+)$/g;
|
||||||
var wildcardMatcher = /^\*([^\/]+)$/g;
|
var wildcardMatcher = /^\*([^\/]+)$/g;
|
||||||
|
|
||||||
function parsePathString(route: string): StringMap<string, any> {
|
function parsePathString(route: string): {[key: string]: any} {
|
||||||
// normalize route as not starting with a "/". Recognition will
|
// normalize route as not starting with a "/". Recognition will
|
||||||
// also normalize.
|
// also normalize.
|
||||||
if (StringWrapper.startsWith(route, "/")) {
|
if (StringWrapper.startsWith(route, "/")) {
|
||||||
|
@ -278,7 +272,7 @@ export class PathRecognizer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
generate(params: StringMap<string, any>): ComponentInstruction {
|
generate(params: {[key: string]: any}): ComponentInstruction {
|
||||||
var paramTokens = new TouchMap(params);
|
var paramTokens = new TouchMap(params);
|
||||||
|
|
||||||
var path = [];
|
var path = [];
|
||||||
|
@ -298,7 +292,7 @@ export class PathRecognizer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getInstruction(urlPath: string, urlParams: string[], _recognizer: PathRecognizer,
|
private _getInstruction(urlPath: string, urlParams: string[], _recognizer: PathRecognizer,
|
||||||
params: StringMap<string, any>): ComponentInstruction {
|
params: {[key: string]: any}): ComponentInstruction {
|
||||||
var hashKey = urlPath + '?' + urlParams.join('?');
|
var hashKey = urlPath + '?' + urlParams.join('?');
|
||||||
if (this._cache.has(hashKey)) {
|
if (this._cache.has(hashKey)) {
|
||||||
return this._cache.get(hashKey);
|
return this._cache.get(hashKey);
|
||||||
|
|
|
@ -9,13 +9,7 @@ import {
|
||||||
Type
|
Type
|
||||||
} from 'angular2/src/core/facade/lang';
|
} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {
|
import {Map, MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
Map,
|
|
||||||
MapWrapper,
|
|
||||||
ListWrapper,
|
|
||||||
StringMap,
|
|
||||||
StringMapWrapper
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
import {PathRecognizer, PathMatch} from './path_recognizer';
|
import {PathRecognizer, PathMatch} from './path_recognizer';
|
||||||
import {Route, AsyncRoute, AuxRoute, Redirect, RouteDefinition} from './route_config_impl';
|
import {Route, AsyncRoute, AuxRoute, Redirect, RouteDefinition} from './route_config_impl';
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
import {PathMatch} from './path_recognizer';
|
import {PathMatch} from './path_recognizer';
|
||||||
import {RouteRecognizer} from './route_recognizer';
|
import {RouteRecognizer} from './route_recognizer';
|
||||||
import {Instruction, ComponentInstruction, PrimaryInstruction} from './instruction';
|
import {Instruction, ComponentInstruction, PrimaryInstruction} from './instruction';
|
||||||
import {
|
import {ListWrapper, Map, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
ListWrapper,
|
|
||||||
Map,
|
|
||||||
MapWrapper,
|
|
||||||
StringMap,
|
|
||||||
StringMapWrapper
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {
|
import {
|
||||||
isPresent,
|
isPresent,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Directive} from '../core/metadata';
|
import {Directive} from '../core/metadata';
|
||||||
import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
import {Router} from './router';
|
import {Router} from './router';
|
||||||
import {Location} from './location';
|
import {Location} from './location';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {
|
import {
|
||||||
isPresent,
|
isPresent,
|
||||||
isBlank,
|
isBlank,
|
||||||
|
@ -14,7 +14,7 @@ import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptio
|
||||||
export class Url {
|
export class Url {
|
||||||
constructor(public path: string, public child: Url = null,
|
constructor(public path: string, public child: Url = null,
|
||||||
public auxiliary: Url[] = CONST_EXPR([]),
|
public auxiliary: Url[] = CONST_EXPR([]),
|
||||||
public params: StringMap<string, any> = null) {}
|
public params: {[key: string]: any} = null) {}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
return this.path + this._matrixParamsToString() + this._auxToString() + this._childString();
|
return this.path + this._matrixParamsToString() + this._auxToString() + this._childString();
|
||||||
|
@ -41,7 +41,7 @@ export class Url {
|
||||||
|
|
||||||
export class RootUrl extends Url {
|
export class RootUrl extends Url {
|
||||||
constructor(path: string, child: Url = null, auxiliary: Url[] = CONST_EXPR([]),
|
constructor(path: string, child: Url = null, auxiliary: Url[] = CONST_EXPR([]),
|
||||||
params: StringMap<string, any> = null) {
|
params: {[key: string]: any} = null) {
|
||||||
super(path, child, auxiliary, params);
|
super(path, child, auxiliary, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ export class UrlParser {
|
||||||
return new Url(path, child, aux, matrixParams);
|
return new Url(path, child, aux, matrixParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
parseQueryParams(): StringMap<string, any> {
|
parseQueryParams(): {[key: string]: any} {
|
||||||
var params = {};
|
var params = {};
|
||||||
this.capture('?');
|
this.capture('?');
|
||||||
this.parseParam(params);
|
this.parseParam(params);
|
||||||
|
@ -160,7 +160,7 @@ export class UrlParser {
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseMatrixParams(): StringMap<string, any> {
|
parseMatrixParams(): {[key: string]: any} {
|
||||||
var params = {};
|
var params = {};
|
||||||
while (this._remaining.length > 0 && this.peekStartsWith(';')) {
|
while (this._remaining.length > 0 && this.peekStartsWith(';')) {
|
||||||
this.capture(';');
|
this.capture(';');
|
||||||
|
@ -169,7 +169,7 @@ export class UrlParser {
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseParam(params: StringMap<string, any>): void {
|
parseParam(params: {[key: string]: any}): void {
|
||||||
var key = matchUrlSegment(this._remaining);
|
var key = matchUrlSegment(this._remaining);
|
||||||
if (isBlank(key)) {
|
if (isBlank(key)) {
|
||||||
return;
|
return;
|
||||||
|
@ -206,7 +206,7 @@ export class UrlParser {
|
||||||
|
|
||||||
export var parser = new UrlParser();
|
export var parser = new UrlParser();
|
||||||
|
|
||||||
export function serializeParams(paramMap: StringMap<string, any>): string[] {
|
export function serializeParams(paramMap: {[key: string]: any}): string[] {
|
||||||
var params = [];
|
var params = [];
|
||||||
if (isPresent(paramMap)) {
|
if (isPresent(paramMap)) {
|
||||||
StringMapWrapper.forEach(paramMap, (value, key) => {
|
StringMapWrapper.forEach(paramMap, (value, key) => {
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class ClientMessageBroker {
|
||||||
this._sink = messageBus.to(channel);
|
this._sink = messageBus.to(channel);
|
||||||
var source = messageBus.from(channel);
|
var source = messageBus.from(channel);
|
||||||
ObservableWrapper.subscribe(source,
|
ObservableWrapper.subscribe(source,
|
||||||
(message: StringMap<string, any>) => this._handleMessage(message));
|
(message: {[key: string]: any}) => this._handleMessage(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _generateMessageId(name: string): string {
|
private _generateMessageId(name: string): string {
|
||||||
|
@ -99,7 +99,7 @@ export class ClientMessageBroker {
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleMessage(message: StringMap<string, any>): void {
|
private _handleMessage(message: {[key: string]: any}): void {
|
||||||
var data = new MessageData(message);
|
var data = new MessageData(message);
|
||||||
// TODO(jteplitz602): replace these strings with messaging constants #3685
|
// TODO(jteplitz602): replace these strings with messaging constants #3685
|
||||||
if (StringWrapper.equals(data.type, "result") || StringWrapper.equals(data.type, "error")) {
|
if (StringWrapper.equals(data.type, "result") || StringWrapper.equals(data.type, "error")) {
|
||||||
|
@ -121,7 +121,7 @@ class MessageData {
|
||||||
value: any;
|
value: any;
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
constructor(data: StringMap<string, any>) {
|
constructor(data: {[key: string]: any}) {
|
||||||
this.type = StringMapWrapper.get(data, "type");
|
this.type = StringMapWrapper.get(data, "type");
|
||||||
this.id = this._getValueIfPresent(data, "id");
|
this.id = this._getValueIfPresent(data, "id");
|
||||||
this.value = this._getValueIfPresent(data, "value");
|
this.value = this._getValueIfPresent(data, "value");
|
||||||
|
@ -130,7 +130,7 @@ class MessageData {
|
||||||
/**
|
/**
|
||||||
* Returns the value from the StringMap if present. Otherwise returns null
|
* Returns the value from the StringMap if present. Otherwise returns null
|
||||||
*/
|
*/
|
||||||
_getValueIfPresent(data: StringMap<string, any>, key: string) {
|
_getValueIfPresent(data: {[key: string]: any}, key: string) {
|
||||||
if (StringMapWrapper.contains(data, key)) {
|
if (StringMapWrapper.contains(data, key)) {
|
||||||
return StringMapWrapper.get(data, key);
|
return StringMapWrapper.get(data, key);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
} from "angular2/src/web_workers/shared/message_bus";
|
} from "angular2/src/web_workers/shared/message_bus";
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {EventEmitter} from 'angular2/src/core/facade/async';
|
import {EventEmitter} from 'angular2/src/core/facade/async';
|
||||||
import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {Injectable} from "angular2/src/core/di";
|
import {Injectable} from "angular2/src/core/di";
|
||||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ export class PostMessageBus implements MessageBus {
|
||||||
|
|
||||||
export class PostMessageBusSink implements MessageBusSink {
|
export class PostMessageBusSink implements MessageBusSink {
|
||||||
private _zone: NgZone;
|
private _zone: NgZone;
|
||||||
private _channels: StringMap<string, _Channel> = StringMapWrapper.create();
|
private _channels: {[key: string]: _Channel} = StringMapWrapper.create();
|
||||||
private _messageBuffer: Array<Object> = [];
|
private _messageBuffer: Array<Object> = [];
|
||||||
|
|
||||||
constructor(private _postMessageTarget: PostMessageTarget) {}
|
constructor(private _postMessageTarget: PostMessageTarget) {}
|
||||||
|
@ -83,7 +83,7 @@ export class PostMessageBusSink implements MessageBusSink {
|
||||||
|
|
||||||
export class PostMessageBusSource implements MessageBusSource {
|
export class PostMessageBusSource implements MessageBusSource {
|
||||||
private _zone: NgZone;
|
private _zone: NgZone;
|
||||||
private _channels: StringMap<string, _Channel> = StringMapWrapper.create();
|
private _channels: {[key: string]: _Channel} = StringMapWrapper.create();
|
||||||
|
|
||||||
constructor(eventTarget?: EventTarget) {
|
constructor(eventTarget?: EventTarget) {
|
||||||
if (eventTarget) {
|
if (eventTarget) {
|
||||||
|
|
|
@ -112,7 +112,7 @@ export class RenderViewWithFragmentsStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
serializeViewWithFragments(view: RenderViewWithFragments): StringMap<string, any> {
|
serializeViewWithFragments(view: RenderViewWithFragments): {[key: string]: any} {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ export class RenderViewWithFragmentsStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deserializeViewWithFragments(obj: StringMap<string, any>): RenderViewWithFragments {
|
deserializeViewWithFragments(obj: {[key: string]: any}): RenderViewWithFragments {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,7 @@ import {
|
||||||
} from "angular2/src/core/facade/lang";
|
} from "angular2/src/core/facade/lang";
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
|
|
||||||
import {
|
import {ListWrapper, Map, StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
|
||||||
ListWrapper,
|
|
||||||
Map,
|
|
||||||
StringMap,
|
|
||||||
StringMapWrapper,
|
|
||||||
MapWrapper
|
|
||||||
} from "angular2/src/core/facade/collection";
|
|
||||||
import {
|
import {
|
||||||
RenderProtoViewRef,
|
RenderProtoViewRef,
|
||||||
RenderViewRef,
|
RenderViewRef,
|
||||||
|
@ -144,7 +138,7 @@ export class Serializer {
|
||||||
* If the values need to be deserialized pass in their type
|
* If the values need to be deserialized pass in their type
|
||||||
* and they will be deserialized before being placed in the map
|
* and they will be deserialized before being placed in the map
|
||||||
*/
|
*/
|
||||||
objectToMap(obj: StringMap<string, any>, type?: Type, data?: any): Map<string, any> {
|
objectToMap(obj: {[key: string]: any}, type?: Type, data?: any): Map<string, any> {
|
||||||
if (isPresent(type)) {
|
if (isPresent(type)) {
|
||||||
var map = new Map<string, any>();
|
var map = new Map<string, any>();
|
||||||
StringMapWrapper.forEach(obj,
|
StringMapWrapper.forEach(obj,
|
||||||
|
@ -157,14 +151,14 @@ export class Serializer {
|
||||||
|
|
||||||
allocateRenderViews(fragmentCount: number) { this._renderViewStore.allocate(fragmentCount); }
|
allocateRenderViews(fragmentCount: number) { this._renderViewStore.allocate(fragmentCount); }
|
||||||
|
|
||||||
private _serializeWorkerElementRef(elementRef: RenderElementRef): StringMap<string, any> {
|
private _serializeWorkerElementRef(elementRef: RenderElementRef): {[key: string]: any} {
|
||||||
return {
|
return {
|
||||||
'renderView': this.serialize(elementRef.renderView, RenderViewRef),
|
'renderView': this.serialize(elementRef.renderView, RenderViewRef),
|
||||||
'boundElementIndex': elementRef.boundElementIndex
|
'boundElementIndex': elementRef.boundElementIndex
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private _deserializeWorkerElementRef(map: StringMap<string, any>): RenderElementRef {
|
private _deserializeWorkerElementRef(map: {[key: string]: any}): RenderElementRef {
|
||||||
return new WebWorkerElementRef(this.deserialize(map['renderView'], RenderViewRef),
|
return new WebWorkerElementRef(this.deserialize(map['renderView'], RenderViewRef),
|
||||||
map['boundElementIndex']);
|
map['boundElementIndex']);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +168,7 @@ function serializeTemplateCmd(cmd: RenderTemplateCmd): Object {
|
||||||
return cmd.visit(RENDER_TEMPLATE_CMD_SERIALIZER, null);
|
return cmd.visit(RENDER_TEMPLATE_CMD_SERIALIZER, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deserializeTemplateCmd(data: StringMap<string, any>): RenderTemplateCmd {
|
function deserializeTemplateCmd(data: {[key: string]: any}): RenderTemplateCmd {
|
||||||
return RENDER_TEMPLATE_CMD_DESERIALIZERS[data['deserializerIndex']](data);
|
return RENDER_TEMPLATE_CMD_DESERIALIZERS[data['deserializerIndex']](data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,18 +226,18 @@ class RenderTemplateCmdSerializer implements RenderCommandVisitor {
|
||||||
var RENDER_TEMPLATE_CMD_SERIALIZER = new RenderTemplateCmdSerializer();
|
var RENDER_TEMPLATE_CMD_SERIALIZER = new RenderTemplateCmdSerializer();
|
||||||
|
|
||||||
var RENDER_TEMPLATE_CMD_DESERIALIZERS = [
|
var RENDER_TEMPLATE_CMD_DESERIALIZERS = [
|
||||||
(data: StringMap<string, any>) =>
|
(data: {[key: string]: any}) =>
|
||||||
new WebWorkerTextCmd(data['isBound'], data['ngContentIndex'], data['value']),
|
new WebWorkerTextCmd(data['isBound'], data['ngContentIndex'], data['value']),
|
||||||
(data: StringMap<string, any>) => new WebWorkerNgContentCmd(data['ngContentIndex']),
|
(data: {[key: string]: any}) => new WebWorkerNgContentCmd(data['ngContentIndex']),
|
||||||
(data: StringMap<string, any>) =>
|
(data: {[key: string]: any}) =>
|
||||||
new WebWorkerBeginElementCmd(data['isBound'], data['ngContentIndex'], data['name'],
|
new WebWorkerBeginElementCmd(data['isBound'], data['ngContentIndex'], data['name'],
|
||||||
data['attrNameAndValues'], data['eventTargetAndNames']),
|
data['attrNameAndValues'], data['eventTargetAndNames']),
|
||||||
(data: StringMap<string, any>) => new WebWorkerEndElementCmd(),
|
(data: {[key: string]: any}) => new WebWorkerEndElementCmd(),
|
||||||
(data: StringMap<string, any>) => new WebWorkerBeginComponentCmd(
|
(data: {[key: string]: any}) => new WebWorkerBeginComponentCmd(
|
||||||
data['isBound'], data['ngContentIndex'], data['name'], data['attrNameAndValues'],
|
data['isBound'], data['ngContentIndex'], data['name'], data['attrNameAndValues'],
|
||||||
data['eventTargetAndNames'], data['nativeShadow'], data['templateId']),
|
data['eventTargetAndNames'], data['nativeShadow'], data['templateId']),
|
||||||
(data: StringMap<string, any>) => new WebWorkerEndComponentCmd(),
|
(data: {[key: string]: any}) => new WebWorkerEndComponentCmd(),
|
||||||
(data: StringMap<string, any>) => new WebWorkerEmbeddedTemplateCmd(
|
(data: {[key: string]: any}) => new WebWorkerEmbeddedTemplateCmd(
|
||||||
data['isBound'], data['ngContentIndex'], data['name'], data['attrNameAndValues'],
|
data['isBound'], data['ngContentIndex'], data['name'], data['attrNameAndValues'],
|
||||||
data['eventTargetAndNames'], data['isMerged'],
|
data['eventTargetAndNames'], data['isMerged'],
|
||||||
(<any[]>data['children']).map(childData => deserializeTemplateCmd(childData))),
|
(<any[]>data['children']).map(childData => deserializeTemplateCmd(childData))),
|
||||||
|
|
|
@ -61,7 +61,7 @@ export class ServiceMessageBroker {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleMessage(map: StringMap<string, any>): void {
|
private _handleMessage(map: {[key: string]: any}): void {
|
||||||
var message = new ReceivedMessage(map);
|
var message = new ReceivedMessage(map);
|
||||||
if (this._methods.has(message.method)) {
|
if (this._methods.has(message.method)) {
|
||||||
this._methods.get(message.method)(message);
|
this._methods.get(message.method)(message);
|
||||||
|
@ -83,7 +83,7 @@ export class ReceivedMessage {
|
||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
|
||||||
constructor(data: StringMap<string, any>) {
|
constructor(data: {[key: string]: any}) {
|
||||||
this.method = data['method'];
|
this.method = data['method'];
|
||||||
this.args = data['args'];
|
this.args = data['args'];
|
||||||
this.id = data['id'];
|
this.id = data['id'];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {StringMap, Set} from 'angular2/src/core/facade/collection';
|
import {Set} from 'angular2/src/core/facade/collection';
|
||||||
import {isPresent} from 'angular2/src/core/facade/lang';
|
import {isPresent} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
const MOUSE_EVENT_PROPERTIES = [
|
const MOUSE_EVENT_PROPERTIES = [
|
||||||
|
@ -37,28 +37,28 @@ const EVENT_PROPERTIES = ['type', 'bubbles', 'cancelable'];
|
||||||
const NODES_WITH_VALUE =
|
const NODES_WITH_VALUE =
|
||||||
new Set(["input", "select", "option", "button", "li", "meter", "progress", "param"]);
|
new Set(["input", "select", "option", "button", "li", "meter", "progress", "param"]);
|
||||||
|
|
||||||
export function serializeGenericEvent(e: Event): StringMap<string, any> {
|
export function serializeGenericEvent(e: Event): {[key: string]: any} {
|
||||||
return serializeEvent(e, EVENT_PROPERTIES);
|
return serializeEvent(e, EVENT_PROPERTIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(jteplitz602): Allow users to specify the properties they need rather than always
|
// TODO(jteplitz602): Allow users to specify the properties they need rather than always
|
||||||
// adding value and files #3374
|
// adding value and files #3374
|
||||||
export function serializeEventWithTarget(e: Event): StringMap<string, any> {
|
export function serializeEventWithTarget(e: Event): {[key: string]: any} {
|
||||||
var serializedEvent = serializeEvent(e, EVENT_PROPERTIES);
|
var serializedEvent = serializeEvent(e, EVENT_PROPERTIES);
|
||||||
return addTarget(e, serializedEvent);
|
return addTarget(e, serializedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function serializeMouseEvent(e: MouseEvent): StringMap<string, any> {
|
export function serializeMouseEvent(e: MouseEvent): {[key: string]: any} {
|
||||||
return serializeEvent(e, MOUSE_EVENT_PROPERTIES);
|
return serializeEvent(e, MOUSE_EVENT_PROPERTIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function serializeKeyboardEvent(e: KeyboardEvent): StringMap<string, any> {
|
export function serializeKeyboardEvent(e: KeyboardEvent): {[key: string]: any} {
|
||||||
var serializedEvent = serializeEvent(e, KEYBOARD_EVENT_PROPERTIES);
|
var serializedEvent = serializeEvent(e, KEYBOARD_EVENT_PROPERTIES);
|
||||||
return addTarget(e, serializedEvent);
|
return addTarget(e, serializedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(jteplitz602): #3374. See above.
|
// TODO(jteplitz602): #3374. See above.
|
||||||
function addTarget(e: Event, serializedEvent: StringMap<string, any>): StringMap<string, any> {
|
function addTarget(e: Event, serializedEvent: {[key: string]: any}): {[key: string]: any} {
|
||||||
if (NODES_WITH_VALUE.has((<HTMLElement>e.target).tagName.toLowerCase())) {
|
if (NODES_WITH_VALUE.has((<HTMLElement>e.target).tagName.toLowerCase())) {
|
||||||
var target = <HTMLInputElement>e.target;
|
var target = <HTMLInputElement>e.target;
|
||||||
serializedEvent['target'] = {'value': target.value};
|
serializedEvent['target'] = {'value': target.value};
|
||||||
|
@ -69,7 +69,7 @@ function addTarget(e: Event, serializedEvent: StringMap<string, any>): StringMap
|
||||||
return serializedEvent;
|
return serializedEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
function serializeEvent(e: any, properties: string[]): StringMap<string, any> {
|
function serializeEvent(e: any, properties: string[]): {[key: string]: any} {
|
||||||
var serialized = {};
|
var serialized = {};
|
||||||
for (var i = 0; i < properties.length; i++) {
|
for (var i = 0; i < properties.length; i++) {
|
||||||
var prop = properties[i];
|
var prop = properties[i];
|
||||||
|
|
|
@ -84,7 +84,7 @@ class PrintLogger {
|
||||||
logGroupEnd() {}
|
logGroupEnd() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function webWorkerBindings(appComponentType, bus: MessageBus, initData: StringMap<string, any>):
|
function webWorkerBindings(appComponentType, bus: MessageBus, initData: {[key: string]: any}):
|
||||||
Array<Type | Binding | any[]> {
|
Array<Type | Binding | any[]> {
|
||||||
return [
|
return [
|
||||||
compilerBindings(),
|
compilerBindings(),
|
||||||
|
@ -118,7 +118,7 @@ export function bootstrapWebWorkerCommon(appComponentType: Type, bus: MessageBus
|
||||||
|
|
||||||
var subscription: any;
|
var subscription: any;
|
||||||
var emitter = bus.from(SETUP_CHANNEL);
|
var emitter = bus.from(SETUP_CHANNEL);
|
||||||
subscription = ObservableWrapper.subscribe(emitter, (message: StringMap<string, any>) => {
|
subscription = ObservableWrapper.subscribe(emitter, (message: {[key: string]: any}) => {
|
||||||
var bindings =
|
var bindings =
|
||||||
[applicationCommonBindings(), webWorkerBindings(appComponentType, bus, message)];
|
[applicationCommonBindings(), webWorkerBindings(appComponentType, bus, message)];
|
||||||
if (isPresent(appBindings)) {
|
if (isPresent(appBindings)) {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {StringMap} from "angular2/src/core/facade/collection";
|
|
||||||
|
|
||||||
// no deserialization is necessary in TS.
|
// no deserialization is necessary in TS.
|
||||||
// This is only here to match dart interface
|
// This is only here to match dart interface
|
||||||
export function deserializeGenericEvent(serializedEvent: StringMap<string, any>):
|
export function deserializeGenericEvent(serializedEvent: {[key: string]: any}):
|
||||||
StringMap<string, any> {
|
{[key: string]: any} {
|
||||||
return serializedEvent;
|
return serializedEvent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class RenderEventData {
|
||||||
eventName: string;
|
eventName: string;
|
||||||
locals: Map<string, any>;
|
locals: Map<string, any>;
|
||||||
|
|
||||||
constructor(message: StringMap<string, any>, serializer: Serializer) {
|
constructor(message: {[key: string]: any}, serializer: Serializer) {
|
||||||
this.viewRef = serializer.deserialize(message['viewRef'], RenderViewRef);
|
this.viewRef = serializer.deserialize(message['viewRef'], RenderViewRef);
|
||||||
this.elementIndex = message['elementIndex'];
|
this.elementIndex = message['elementIndex'];
|
||||||
this.eventName = message['eventName'];
|
this.eventName = message['eventName'];
|
||||||
|
|
|
@ -176,7 +176,7 @@ class _ExpressionWithLocals {
|
||||||
* Map from test id to _ExpressionWithLocals.
|
* Map from test id to _ExpressionWithLocals.
|
||||||
* Tests in this map define an expression and local values which those expressions refer to.
|
* Tests in this map define an expression and local values which those expressions refer to.
|
||||||
*/
|
*/
|
||||||
static availableDefinitions: StringMap<string, _ExpressionWithLocals> = {
|
static availableDefinitions: {[key: string]: _ExpressionWithLocals} = {
|
||||||
'valueFromLocals': new _ExpressionWithLocals(
|
'valueFromLocals': new _ExpressionWithLocals(
|
||||||
'key', new Locals(null, MapWrapper.createFromPairs([['key', 'value']]))),
|
'key', new Locals(null, MapWrapper.createFromPairs([['key', 'value']]))),
|
||||||
'functionFromLocals': new _ExpressionWithLocals(
|
'functionFromLocals': new _ExpressionWithLocals(
|
||||||
|
@ -241,7 +241,7 @@ class _ExpressionWithMode {
|
||||||
* Map from test id to _ExpressionWithMode.
|
* Map from test id to _ExpressionWithMode.
|
||||||
* Definitions in this map define conditions which allow testing various change detector modes.
|
* Definitions in this map define conditions which allow testing various change detector modes.
|
||||||
*/
|
*/
|
||||||
static availableDefinitions: StringMap<string, _ExpressionWithMode> = {
|
static availableDefinitions: {[key: string]: _ExpressionWithMode} = {
|
||||||
'emptyUsingDefaultStrategy':
|
'emptyUsingDefaultStrategy':
|
||||||
new _ExpressionWithMode(ChangeDetectionStrategy.Default, false, false),
|
new _ExpressionWithMode(ChangeDetectionStrategy.Default, false, false),
|
||||||
'emptyUsingOnPushStrategy':
|
'emptyUsingOnPushStrategy':
|
||||||
|
@ -316,7 +316,7 @@ class _DirectiveUpdating {
|
||||||
* Definitions in this map define definitions which allow testing directive updating.
|
* Definitions in this map define definitions which allow testing directive updating.
|
||||||
*/
|
*/
|
||||||
static availableDefinitions:
|
static availableDefinitions:
|
||||||
StringMap<string, _DirectiveUpdating> = {
|
{[key: string]: _DirectiveUpdating} = {
|
||||||
'directNoDispatcher': new _DirectiveUpdating(
|
'directNoDispatcher': new _DirectiveUpdating(
|
||||||
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
|
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
|
||||||
[_DirectiveUpdating.basicRecords[0]]),
|
[_DirectiveUpdating.basicRecords[0]]),
|
||||||
|
|
|
@ -117,7 +117,7 @@ class DirectiveWithoutModuleId {
|
||||||
class ComponentWithEverything implements OnChanges,
|
class ComponentWithEverything implements OnChanges,
|
||||||
OnInit, DoCheck, OnDestroy, AfterContentInit, AfterContentChecked, AfterViewInit,
|
OnInit, DoCheck, OnDestroy, AfterContentInit, AfterContentChecked, AfterViewInit,
|
||||||
AfterViewChecked {
|
AfterViewChecked {
|
||||||
onChanges(changes: StringMap<string, SimpleChange>): void {}
|
onChanges(changes: {[key: string]: SimpleChange}): void {}
|
||||||
onInit(): void {}
|
onInit(): void {}
|
||||||
doCheck(): void {}
|
doCheck(): void {}
|
||||||
onDestroy(): void {}
|
onDestroy(): void {}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
|
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
|
||||||
import {StringMap} from 'angular2/src/core/facade/collection';
|
|
||||||
import {isPresent} from 'angular2/src/core/facade/lang';
|
import {isPresent} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
export class MockSchemaRegistry implements ElementSchemaRegistry {
|
export class MockSchemaRegistry implements ElementSchemaRegistry {
|
||||||
constructor(public existingProperties: StringMap<string, boolean>,
|
constructor(public existingProperties: {[key: string]: boolean},
|
||||||
public attrPropMapping: StringMap<string, string>) {}
|
public attrPropMapping: {[key: string]: string}) {}
|
||||||
hasProperty(tagName: string, property: string): boolean {
|
hasProperty(tagName: string, property: string): boolean {
|
||||||
var result = this.existingProperties[property];
|
var result = this.existingProperties[property];
|
||||||
return isPresent(result) ? result : true;
|
return isPresent(result) ? result : true;
|
||||||
|
|
|
@ -325,10 +325,10 @@ function testableStylesModule(sourceModule: SourceModule): SourceModule {
|
||||||
|
|
||||||
// Attention: read by eval!
|
// Attention: read by eval!
|
||||||
export function humanizeTemplate(template: CompiledTemplate,
|
export function humanizeTemplate(template: CompiledTemplate,
|
||||||
humanizedTemplates: Map<number, StringMap<string, any>> = null):
|
humanizedTemplates: Map<number, {[key: string]: any}> = null):
|
||||||
StringMap<string, any> {
|
{[key: string]: any} {
|
||||||
if (isBlank(humanizedTemplates)) {
|
if (isBlank(humanizedTemplates)) {
|
||||||
humanizedTemplates = new Map<number, StringMap<string, any>>();
|
humanizedTemplates = new Map<number, {[key: string]: any}>();
|
||||||
}
|
}
|
||||||
var result = humanizedTemplates.get(template.id);
|
var result = humanizedTemplates.get(template.id);
|
||||||
if (isPresent(result)) {
|
if (isPresent(result)) {
|
||||||
|
@ -369,7 +369,7 @@ function testChangeDetector(changeDetectorFactory: Function): string[] {
|
||||||
|
|
||||||
class CommandHumanizer implements CommandVisitor {
|
class CommandHumanizer implements CommandVisitor {
|
||||||
constructor(private result: any[],
|
constructor(private result: any[],
|
||||||
private humanizedTemplates: Map<number, StringMap<string, any>>) {}
|
private humanizedTemplates: Map<number, {[key: string]: any}>) {}
|
||||||
visitText(cmd: TextCmd, context: any): any {
|
visitText(cmd: TextCmd, context: any): any {
|
||||||
this.result.push(`#text(${cmd.value})`);
|
this.result.push(`#text(${cmd.value})`);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit} from 'angular2/test_lib';
|
import {describe, it, expect, beforeEach, ddescribe, iit, xit} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {
|
import {ListWrapper, StringMapWrapper, MapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
ListWrapper,
|
|
||||||
StringMap,
|
|
||||||
StringMapWrapper,
|
|
||||||
MapWrapper
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('ListWrapper', () => {
|
describe('ListWrapper', () => {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
SpyObject
|
SpyObject
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {Map, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {Map, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
import {RouteRecognizer} from 'angular2/src/router/route_recognizer';
|
import {RouteRecognizer} from 'angular2/src/router/route_recognizer';
|
||||||
import {ComponentInstruction} from 'angular2/src/router/instruction';
|
import {ComponentInstruction} from 'angular2/src/router/instruction';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {StringMap, StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {
|
import {
|
||||||
MessageBusSink,
|
MessageBusSink,
|
||||||
MessageBusSource,
|
MessageBusSource,
|
||||||
|
@ -13,11 +13,11 @@ import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||||
* Such that whatever goes into one's sink comes out the others source.
|
* Such that whatever goes into one's sink comes out the others source.
|
||||||
*/
|
*/
|
||||||
export function createPairedMessageBuses(): PairedMessageBuses {
|
export function createPairedMessageBuses(): PairedMessageBuses {
|
||||||
var firstChannels: StringMap<string, MockEventEmitter> = {};
|
var firstChannels: {[key: string]: MockEventEmitter} = {};
|
||||||
var workerMessageBusSink = new MockMessageBusSink(firstChannels);
|
var workerMessageBusSink = new MockMessageBusSink(firstChannels);
|
||||||
var uiMessageBusSource = new MockMessageBusSource(firstChannels);
|
var uiMessageBusSource = new MockMessageBusSource(firstChannels);
|
||||||
|
|
||||||
var secondChannels: StringMap<string, MockEventEmitter> = {};
|
var secondChannels: {[key: string]: MockEventEmitter} = {};
|
||||||
var uiMessageBusSink = new MockMessageBusSink(secondChannels);
|
var uiMessageBusSink = new MockMessageBusSink(secondChannels);
|
||||||
var workerMessageBusSource = new MockMessageBusSource(secondChannels);
|
var workerMessageBusSource = new MockMessageBusSource(secondChannels);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export class PairedMessageBuses {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MockMessageBusSource implements MessageBusSource {
|
export class MockMessageBusSource implements MessageBusSource {
|
||||||
constructor(private _channels: StringMap<string, MockEventEmitter>) {}
|
constructor(private _channels: {[key: string]: MockEventEmitter}) {}
|
||||||
|
|
||||||
initChannel(channel: string, runInZone = true) {
|
initChannel(channel: string, runInZone = true) {
|
||||||
if (!StringMapWrapper.contains(this._channels, channel)) {
|
if (!StringMapWrapper.contains(this._channels, channel)) {
|
||||||
|
@ -49,7 +49,7 @@ export class MockMessageBusSource implements MessageBusSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MockMessageBusSink implements MessageBusSink {
|
export class MockMessageBusSink implements MessageBusSink {
|
||||||
constructor(private _channels: StringMap<string, MockEventEmitter>) {}
|
constructor(private _channels: {[key: string]: MockEventEmitter}) {}
|
||||||
|
|
||||||
initChannel(channel: string, runInZone = true) {
|
initChannel(channel: string, runInZone = true) {
|
||||||
if (!StringMapWrapper.contains(this._channels, channel)) {
|
if (!StringMapWrapper.contains(this._channels, channel)) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {Date, DateWrapper} from 'angular2/src/core/facade/lang';
|
import {Date, DateWrapper} from 'angular2/src/core/facade/lang';
|
||||||
import {StringMap, Map} from 'angular2/src/core/facade/collection';
|
import {Map} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
export class MeasureValues {
|
export class MeasureValues {
|
||||||
constructor(public runIndex: number, public timeStamp: Date,
|
constructor(public runIndex: number, public timeStamp: Date,
|
||||||
public values: StringMap<string, any>) {}
|
public values: {[key: string]: any}) {}
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {bind, Binding} from 'angular2/src/core/di';
|
import {bind, Binding} from 'angular2/src/core/di';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {StringMap} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A metric is measures values
|
* A metric is measures values
|
||||||
|
@ -21,11 +20,11 @@ export abstract class Metric {
|
||||||
* since the begin call.
|
* since the begin call.
|
||||||
* @param restart: Whether to restart right after this.
|
* @param restart: Whether to restart right after this.
|
||||||
*/
|
*/
|
||||||
endMeasure(restart: boolean): Promise<StringMap<string, any>> { throw new BaseException('NYI'); }
|
endMeasure(restart: boolean): Promise<{[key: string]: any}> { throw new BaseException('NYI'); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the metrics provided by this metric implementation.
|
* Describes the metrics provided by this metric implementation.
|
||||||
* (e.g. units, ...)
|
* (e.g. units, ...)
|
||||||
*/
|
*/
|
||||||
describe(): StringMap<string, any> { throw new BaseException('NYI'); }
|
describe(): {[key: string]: any} { throw new BaseException('NYI'); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||||
import {ListWrapper, StringMapWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
|
|
||||||
import {Metric} from '../metric';
|
import {Metric} from '../metric';
|
||||||
|
@ -29,7 +29,7 @@ export class MultiMetric extends Metric {
|
||||||
* since the begin call.
|
* since the begin call.
|
||||||
* @param restart: Whether to restart right after this.
|
* @param restart: Whether to restart right after this.
|
||||||
*/
|
*/
|
||||||
endMeasure(restart: boolean): Promise<StringMap<string, any>> {
|
endMeasure(restart: boolean): Promise<{[key: string]: any}> {
|
||||||
return PromiseWrapper.all(
|
return PromiseWrapper.all(
|
||||||
ListWrapper.map(this._metrics, (metric) => metric.endMeasure(restart)))
|
ListWrapper.map(this._metrics, (metric) => metric.endMeasure(restart)))
|
||||||
.then((values) => { return mergeStringMaps(values); });
|
.then((values) => { return mergeStringMaps(values); });
|
||||||
|
@ -39,7 +39,7 @@ export class MultiMetric extends Metric {
|
||||||
* Describes the metrics provided by this metric implementation.
|
* Describes the metrics provided by this metric implementation.
|
||||||
* (e.g. units, ...)
|
* (e.g. units, ...)
|
||||||
*/
|
*/
|
||||||
describe(): StringMap<string, any> {
|
describe(): {[key: string]: any} {
|
||||||
return mergeStringMaps(this._metrics.map((metric) => metric.describe()));
|
return mergeStringMaps(this._metrics.map((metric) => metric.describe()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
NumberWrapper
|
NumberWrapper
|
||||||
} from 'angular2/src/core/facade/lang';
|
} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {ListWrapper, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||||
|
|
||||||
import {WebDriverExtension, PerfLogFeatures} from '../web_driver_extension';
|
import {WebDriverExtension, PerfLogFeatures} from '../web_driver_extension';
|
||||||
|
@ -24,7 +24,7 @@ export class PerflogMetric extends Metric {
|
||||||
// TODO(tbosch): use static values when our transpiler supports them
|
// TODO(tbosch): use static values when our transpiler supports them
|
||||||
static get SET_TIMEOUT(): OpaqueToken { return _SET_TIMEOUT; }
|
static get SET_TIMEOUT(): OpaqueToken { return _SET_TIMEOUT; }
|
||||||
|
|
||||||
private _remainingEvents: Array<StringMap<string, any>>;
|
private _remainingEvents: Array<{[key: string]: any}>;
|
||||||
private _measureCount: number;
|
private _measureCount: number;
|
||||||
_perfLogFeatures: PerfLogFeatures;
|
_perfLogFeatures: PerfLogFeatures;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ export class PerflogMetric extends Metric {
|
||||||
* @param microMetrics Name and description of metrics provided via console.time / console.timeEnd
|
* @param microMetrics Name and description of metrics provided via console.time / console.timeEnd
|
||||||
**/
|
**/
|
||||||
constructor(private _driverExtension: WebDriverExtension, private _setTimeout: Function,
|
constructor(private _driverExtension: WebDriverExtension, private _setTimeout: Function,
|
||||||
private _microMetrics: StringMap<string, any>, private _forceGc: boolean,
|
private _microMetrics: {[key: string]: any}, private _forceGc: boolean,
|
||||||
private _captureFrames: boolean) {
|
private _captureFrames: boolean) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export class PerflogMetric extends Metric {
|
||||||
this._perfLogFeatures = _driverExtension.perfLogFeatures();
|
this._perfLogFeatures = _driverExtension.perfLogFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
describe(): StringMap<string, any> {
|
describe(): {[key: string]: any} {
|
||||||
var res = {
|
var res = {
|
||||||
'scriptTime': 'script execution time in ms, including gc and render',
|
'scriptTime': 'script execution time in ms, including gc and render',
|
||||||
'pureScriptTime': 'script execution time in ms, without gc nor render'
|
'pureScriptTime': 'script execution time in ms, without gc nor render'
|
||||||
|
@ -89,7 +89,7 @@ export class PerflogMetric extends Metric {
|
||||||
return resultPromise.then((_) => this._beginMeasure());
|
return resultPromise.then((_) => this._beginMeasure());
|
||||||
}
|
}
|
||||||
|
|
||||||
endMeasure(restart: boolean): Promise<StringMap<string, any>> {
|
endMeasure(restart: boolean): Promise<{[key: string]: any}> {
|
||||||
if (this._forceGc) {
|
if (this._forceGc) {
|
||||||
return this._endPlainMeasureAndMeasureForceGc(restart);
|
return this._endPlainMeasureAndMeasureForceGc(restart);
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,7 +117,7 @@ export class PerflogMetric extends Metric {
|
||||||
return this._driverExtension.timeBegin(this._markName(this._measureCount++));
|
return this._driverExtension.timeBegin(this._markName(this._measureCount++));
|
||||||
}
|
}
|
||||||
|
|
||||||
_endMeasure(restart: boolean): Promise<StringMap<string, any>> {
|
_endMeasure(restart: boolean): Promise<{[key: string]: any}> {
|
||||||
var markName = this._markName(this._measureCount - 1);
|
var markName = this._markName(this._measureCount - 1);
|
||||||
var nextMarkName = restart ? this._markName(this._measureCount++) : null;
|
var nextMarkName = restart ? this._markName(this._measureCount++) : null;
|
||||||
return this._driverExtension.timeEnd(markName, nextMarkName)
|
return this._driverExtension.timeEnd(markName, nextMarkName)
|
||||||
|
@ -171,7 +171,7 @@ export class PerflogMetric extends Metric {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_aggregateEvents(events: Array<StringMap<string, any>>, markName): StringMap<string, any> {
|
_aggregateEvents(events: Array<{[key: string]: any}>, markName): {[key: string]: any} {
|
||||||
var result = {'scriptTime': 0, 'pureScriptTime': 0};
|
var result = {'scriptTime': 0, 'pureScriptTime': 0};
|
||||||
if (this._perfLogFeatures.gc) {
|
if (this._perfLogFeatures.gc) {
|
||||||
result['gcTime'] = 0;
|
result['gcTime'] = 0;
|
||||||
|
@ -199,8 +199,8 @@ export class PerflogMetric extends Metric {
|
||||||
var frameCaptureStartEvent = null;
|
var frameCaptureStartEvent = null;
|
||||||
var frameCaptureEndEvent = null;
|
var frameCaptureEndEvent = null;
|
||||||
|
|
||||||
var intervalStarts: StringMap<string, any> = {};
|
var intervalStarts: {[key: string]: any} = {};
|
||||||
var intervalStartCount: StringMap<string, number> = {};
|
var intervalStartCount: {[key: string]: number} = {};
|
||||||
events.forEach((event) => {
|
events.forEach((event) => {
|
||||||
var ph = event['ph'];
|
var ph = event['ph'];
|
||||||
var name = event['name'];
|
var name = event['name'];
|
||||||
|
@ -307,7 +307,7 @@ export class PerflogMetric extends Metric {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
_addFrameMetrics(result: StringMap<string, any>, frameTimes: any[]) {
|
_addFrameMetrics(result: {[key: string]: any}, frameTimes: any[]) {
|
||||||
result['frameTime.mean'] =
|
result['frameTime.mean'] =
|
||||||
ListWrapper.reduce(frameTimes, (a, b) => a + b, 0) / frameTimes.length;
|
ListWrapper.reduce(frameTimes, (a, b) => a + b, 0) / frameTimes.length;
|
||||||
var firstFrame = frameTimes[0];
|
var firstFrame = frameTimes[0];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {StringMapWrapper, ListWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||||
import {Validator} from './validator';
|
import {Validator} from './validator';
|
||||||
import {Metric} from './metric';
|
import {Metric} from './metric';
|
||||||
|
@ -10,10 +10,10 @@ import {Options} from './common_options';
|
||||||
export class SampleDescription {
|
export class SampleDescription {
|
||||||
// TODO(tbosch): use static values when our transpiler supports them
|
// TODO(tbosch): use static values when our transpiler supports them
|
||||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||||
description: StringMap<string, any>;
|
description: {[key: string]: any};
|
||||||
|
|
||||||
constructor(public id: string, descriptions: Array<StringMap<string, any>>,
|
constructor(public id: string, descriptions: Array<{[key: string]: any}>,
|
||||||
public metrics: StringMap<string, any>) {
|
public metrics: {[key: string]: any}) {
|
||||||
this.description = {};
|
this.description = {};
|
||||||
ListWrapper.forEach(descriptions, (description) => {
|
ListWrapper.forEach(descriptions, (description) => {
|
||||||
StringMapWrapper.forEach(description, (value, prop) => this.description[prop] = value);
|
StringMapWrapper.forEach(description, (value, prop) => this.description[prop] = value);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import {isPresent, isBlank, Date, DateWrapper} from 'angular2/src/core/facade/lang';
|
import {isPresent, isBlank, Date, DateWrapper} from 'angular2/src/core/facade/lang';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {StringMapWrapper, StringMap, ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||||
|
|
||||||
import {Metric} from './metric';
|
import {Metric} from './metric';
|
||||||
|
@ -78,7 +77,7 @@ export class Sampler {
|
||||||
.then((measureValues) => this._report(lastState, measureValues));
|
.then((measureValues) => this._report(lastState, measureValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
_report(state: SampleState, metricValues: StringMap<string, any>): Promise<SampleState> {
|
_report(state: SampleState, metricValues: {[key: string]: any}): Promise<SampleState> {
|
||||||
var measureValues = new MeasureValues(state.completeSample.length, this._now(), metricValues);
|
var measureValues = new MeasureValues(state.completeSample.length, this._now(), metricValues);
|
||||||
var completeSample = state.completeSample.concat([measureValues]);
|
var completeSample = state.completeSample.concat([measureValues]);
|
||||||
var validSample = this._validator.validate(completeSample);
|
var validSample = this._validator.validate(completeSample);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {bind, Binding} from 'angular2/src/core/di';
|
import {bind, Binding} from 'angular2/src/core/di';
|
||||||
import {StringMap} from 'angular2/src/core/facade/collection';
|
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
|
|
||||||
import {MeasureValues} from './measure_values';
|
import {MeasureValues} from './measure_values';
|
||||||
|
@ -23,5 +22,5 @@ export abstract class Validator {
|
||||||
* Returns a Map that describes the properties of the validator
|
* Returns a Map that describes the properties of the validator
|
||||||
* (e.g. sample size, ...)
|
* (e.g. sample size, ...)
|
||||||
*/
|
*/
|
||||||
describe(): StringMap<string, any> { throw new BaseException('NYI'); }
|
describe(): {[key: string]: any} { throw new BaseException('NYI'); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||||
|
|
||||||
import {Validator} from '../validator';
|
import {Validator} from '../validator';
|
||||||
|
@ -26,7 +26,7 @@ export class RegressionSlopeValidator extends Validator {
|
||||||
this._metric = metric;
|
this._metric = metric;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe(): StringMap<string, any> {
|
describe(): {[key: string]: any} {
|
||||||
return {'sampleSize': this._sampleSize, 'regressionSlopeMetric': this._metric};
|
return {'sampleSize': this._sampleSize, 'regressionSlopeMetric': this._metric};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||||
|
|
||||||
import {Validator} from '../validator';
|
import {Validator} from '../validator';
|
||||||
|
@ -20,7 +20,7 @@ export class SizeValidator extends Validator {
|
||||||
this._sampleSize = size;
|
this._sampleSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe(): StringMap<string, any> { return {'sampleSize': this._sampleSize}; }
|
describe(): {[key: string]: any} { return {'sampleSize': this._sampleSize}; }
|
||||||
|
|
||||||
validate(completeSample: MeasureValues[]): MeasureValues[] {
|
validate(completeSample: MeasureValues[]): MeasureValues[] {
|
||||||
if (completeSample.length >= this._sampleSize) {
|
if (completeSample.length >= this._sampleSize) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||||
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
import {Options} from './common_options';
|
import {Options} from './common_options';
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ export abstract class WebDriverExtension {
|
||||||
|
|
||||||
perfLogFeatures(): PerfLogFeatures { throw new BaseException('NYI'); }
|
perfLogFeatures(): PerfLogFeatures { throw new BaseException('NYI'); }
|
||||||
|
|
||||||
supports(capabilities: StringMap<string, any>): boolean { return true; }
|
supports(capabilities: {[key: string]: any}): boolean { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PerfLogFeatures {
|
export class PerfLogFeatures {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {bind, Binding} from 'angular2/src/core/di';
|
import {bind, Binding} from 'angular2/src/core/di';
|
||||||
import {ListWrapper, StringMapWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {
|
import {
|
||||||
Json,
|
Json,
|
||||||
isPresent,
|
isPresent,
|
||||||
|
@ -84,8 +84,8 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _convertPerfRecordsToEvents(chromeEvents: Array<StringMap<string, any>>,
|
private _convertPerfRecordsToEvents(chromeEvents: Array<{[key: string]: any}>,
|
||||||
normalizedEvents: Array<StringMap<string, any>> = null) {
|
normalizedEvents: Array<{[key: string]: any}> = null) {
|
||||||
if (isBlank(normalizedEvents)) {
|
if (isBlank(normalizedEvents)) {
|
||||||
normalizedEvents = [];
|
normalizedEvents = [];
|
||||||
}
|
}
|
||||||
|
@ -214,14 +214,14 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
||||||
return new PerfLogFeatures({render: true, gc: true, frameCapture: true});
|
return new PerfLogFeatures({render: true, gc: true, frameCapture: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
supports(capabilities: StringMap<string, any>): boolean {
|
supports(capabilities: {[key: string]: any}): boolean {
|
||||||
return this._majorChromeVersion != -1 &&
|
return this._majorChromeVersion != -1 &&
|
||||||
StringWrapper.equals(capabilities['browserName'].toLowerCase(), 'chrome');
|
StringWrapper.equals(capabilities['browserName'].toLowerCase(), 'chrome');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeEvent(chromeEvent: StringMap<string, any>, data: StringMap<string, any>):
|
function normalizeEvent(chromeEvent: {[key: string]: any}, data: {[key: string]: any}):
|
||||||
StringMap<string, any> {
|
{[key: string]: any} {
|
||||||
var ph = chromeEvent['ph'];
|
var ph = chromeEvent['ph'];
|
||||||
if (StringWrapper.equals(ph, 'S')) {
|
if (StringWrapper.equals(ph, 'S')) {
|
||||||
ph = 'b';
|
ph = 'b';
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class FirefoxDriverExtension extends WebDriverExtension {
|
||||||
|
|
||||||
perfLogFeatures(): PerfLogFeatures { return new PerfLogFeatures({render: true, gc: true}); }
|
perfLogFeatures(): PerfLogFeatures { return new PerfLogFeatures({render: true, gc: true}); }
|
||||||
|
|
||||||
supports(capabilities: StringMap<string, any>): boolean {
|
supports(capabilities: {[key: string]: any}): boolean {
|
||||||
return StringWrapper.equals(capabilities['browserName'].toLowerCase(), 'firefox');
|
return StringWrapper.equals(capabilities['browserName'].toLowerCase(), 'firefox');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {bind, Binding} from 'angular2/src/core/di';
|
import {bind, Binding} from 'angular2/src/core/di';
|
||||||
import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {
|
import {
|
||||||
Json,
|
Json,
|
||||||
isPresent,
|
isPresent,
|
||||||
|
@ -91,7 +91,7 @@ export class IOsDriverExtension extends WebDriverExtension {
|
||||||
|
|
||||||
perfLogFeatures(): PerfLogFeatures { return new PerfLogFeatures({render: true}); }
|
perfLogFeatures(): PerfLogFeatures { return new PerfLogFeatures({render: true}); }
|
||||||
|
|
||||||
supports(capabilities: StringMap<string, any>): boolean {
|
supports(capabilities: {[key: string]: any}): boolean {
|
||||||
return StringWrapper.equals(capabilities['browserName'].toLowerCase(), 'safari');
|
return StringWrapper.equals(capabilities['browserName'].toLowerCase(), 'safari');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
||||||
|
|
||||||
import {Metric, MultiMetric, bind, Injector} from 'benchpress/common';
|
import {Metric, MultiMetric, bind, Injector} from 'benchpress/common';
|
||||||
|
@ -70,13 +70,13 @@ class MockMetric extends Metric {
|
||||||
|
|
||||||
beginMeasure(): Promise<string> { return PromiseWrapper.resolve(`${this._id}_beginMeasure`); }
|
beginMeasure(): Promise<string> { return PromiseWrapper.resolve(`${this._id}_beginMeasure`); }
|
||||||
|
|
||||||
endMeasure(restart: boolean): Promise<StringMap<string, any>> {
|
endMeasure(restart: boolean): Promise<{[key: string]: any}> {
|
||||||
var result = {};
|
var result = {};
|
||||||
result[this._id] = {'restart': restart};
|
result[this._id] = {'restart': restart};
|
||||||
return PromiseWrapper.resolve(result);
|
return PromiseWrapper.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
describe(): StringMap<string, string> {
|
describe(): {[key: string]: string} {
|
||||||
var result = {};
|
var result = {};
|
||||||
result[this._id] = 'describe';
|
result[this._id] = 'describe';
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
||||||
import {DateWrapper} from 'angular2/src/core/facade/lang';
|
import {DateWrapper} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
|
@ -65,12 +65,12 @@ export function main() {
|
||||||
class MockReporter extends Reporter {
|
class MockReporter extends Reporter {
|
||||||
constructor(private _id: string) { super(); }
|
constructor(private _id: string) { super(); }
|
||||||
|
|
||||||
reportMeasureValues(values: MeasureValues): Promise<StringMap<string, any>> {
|
reportMeasureValues(values: MeasureValues): Promise<{[key: string]: any}> {
|
||||||
return PromiseWrapper.resolve({'id': this._id, 'values': values});
|
return PromiseWrapper.resolve({'id': this._id, 'values': values});
|
||||||
}
|
}
|
||||||
|
|
||||||
reportSample(completeSample: MeasureValues[],
|
reportSample(completeSample: MeasureValues[],
|
||||||
validSample: MeasureValues[]): Promise<StringMap<string, any>> {
|
validSample: MeasureValues[]): Promise<{[key: string]: any}> {
|
||||||
return PromiseWrapper.resolve(
|
return PromiseWrapper.resolve(
|
||||||
{'id': this._id, 'completeSample': completeSample, 'validSample': validSample});
|
{'id': this._id, 'completeSample': completeSample, 'validSample': validSample});
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {StringMap, ListWrapper} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
|
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
|
||||||
import {PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class MockExtension extends WebDriverExtension {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
supports(capabilities: StringMap<string, any>): boolean {
|
supports(capabilities: {[key: string]: any}): boolean {
|
||||||
return StringWrapper.equals(capabilities['browser'], this.id);
|
return StringWrapper.equals(capabilities['browser'], this.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {RegExpWrapper, print, isPresent} from 'angular2/src/core/facade/lang';
|
||||||
/**
|
/**
|
||||||
* Custom validator.
|
* Custom validator.
|
||||||
*/
|
*/
|
||||||
function creditCardValidator(c): StringMap<string, boolean> {
|
function creditCardValidator(c): {[key: string]: boolean} {
|
||||||
if (isPresent(c.value) && RegExpWrapper.test(/^\d{16}$/g, c.value)) {
|
if (isPresent(c.value) && RegExpWrapper.test(/^\d{16}$/g, c.value)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class CheckoutModel {
|
||||||
/**
|
/**
|
||||||
* Custom validator.
|
* Custom validator.
|
||||||
*/
|
*/
|
||||||
function creditCardValidator(c): StringMap<string, boolean> {
|
function creditCardValidator(c): {[key: string]: boolean} {
|
||||||
if (isPresent(c.value) && RegExpWrapper.test(/^\d{16}$/g, c.value)) {
|
if (isPresent(c.value) && RegExpWrapper.test(/^\d{16}$/g, c.value)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10026,7 +10026,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ts2dart": {
|
"ts2dart": {
|
||||||
"version": "0.7.10",
|
"version": "0.7.11",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"source-map": {
|
"source-map": {
|
||||||
"version": "0.4.4",
|
"version": "0.4.4",
|
||||||
|
|
|
@ -15496,9 +15496,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ts2dart": {
|
"ts2dart": {
|
||||||
"version": "0.7.10",
|
"version": "0.7.11",
|
||||||
"from": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.10.tgz",
|
"from": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.11.tgz",
|
||||||
"resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.10.tgz",
|
"resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.11.tgz",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"source-map": {
|
"source-map": {
|
||||||
"version": "0.4.4",
|
"version": "0.4.4",
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
"temp": "^0.8.1",
|
"temp": "^0.8.1",
|
||||||
"ternary-stream": "^1.2.3",
|
"ternary-stream": "^1.2.3",
|
||||||
"through2": "^0.6.1",
|
"through2": "^0.6.1",
|
||||||
"ts2dart": "^0.7.10",
|
"ts2dart": "^0.7.11",
|
||||||
"tsd": "^0.6.5-beta",
|
"tsd": "^0.6.5-beta",
|
||||||
"tslint": "^2.5.0",
|
"tslint": "^2.5.0",
|
||||||
"typescript": "^1.6.2",
|
"typescript": "^1.6.2",
|
||||||
|
|
Loading…
Reference in New Issue