refactor(benchmarks): make setup nicer

- simplify and correct systemjs config
- remove deep imports into Ng2 packages to work with bundles
- have separate Ng2 and Polymer bootstrap files
This commit is contained in:
Tobias Bosch
2016-08-30 14:17:37 -07:00
parent f7b5478e9f
commit 6ea5b05e7c
25 changed files with 260 additions and 320 deletions

View File

@ -7,21 +7,20 @@
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@angular/core": ["../../../dist/packages-dist/core"],
"selenium-webdriver": ["../../../node_modules/@types/selenium-webdriver/index.d.ts"]
"@angular/core": ["../../../dist/packages-dist/core"]
},
"experimentalDecorators": true,
"rootDir": ".",
"sourceRoot": ".",
"outDir": "../../../dist/packages-dist/benchpress",
"declaration": true
"declaration": true,
"skipLibCheck": true
},
"exclude": ["integrationtest"],
"files": [
"index.ts",
"../../../node_modules/@types/node/index.d.ts",
"../../../node_modules/@types/jasmine/index.d.ts",
"../../../node_modules/@types/protractor/index.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -1,61 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {document, window} from './facade/browser';
import {NumberWrapper, isBlank} from './facade/lang';
import {BrowserDomAdapter} from './private_import_platform-browser';
var DOM = new BrowserDomAdapter();
export function getIntParameter(name: string) {
return NumberWrapper.parseInt(getStringParameter(name), 10);
}
export function getStringParameter(name: string) {
var els = DOM.querySelectorAll(document, `input[name="${name}"]`);
var value: any /** TODO #9100 */;
var el: any /** TODO #9100 */;
for (var i = 0; i < els.length; i++) {
el = els[i];
var type = DOM.type(el);
if ((type != 'radio' && type != 'checkbox') || DOM.getChecked(el)) {
value = DOM.getValue(el);
break;
}
}
if (isBlank(value)) {
throw new Error(`Could not find and input field with name ${name}`);
}
return value;
}
export function bindAction(selector: string, callback: Function) {
var el = DOM.querySelector(document, selector);
DOM.on(el, 'click', function(_: any /** TODO #9100 */) { callback(); });
}
export function microBenchmark(
name: any /** TODO #9100 */, iterationCount: any /** TODO #9100 */,
callback: any /** TODO #9100 */) {
var durationName = `${name}/${iterationCount}`;
window.console.time(durationName);
callback();
window.console.timeEnd(durationName);
}
export function windowProfile(name: string): void {
(<any>window.console).profile(name);
}
export function windowProfileEnd(name: string): void {
(<any>window.console).profileEnd(name);
}

View File

@ -546,7 +546,7 @@ export class Router {
resolvePromise(false);
}
},
(e: any) => {
(e: any) => {
if (e instanceof NavigationCancelingError) {
this.navigated = true;
this.routerEvents.next(