chore(playground): clang-format

This commit is contained in:
Jason Choi
2016-08-05 09:56:53 -07:00
committed by Alex Rickabaugh
parent 0d1f3c3b07
commit 6baf3baedd
60 changed files with 3339 additions and 3375 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
declare module "B64" {
declare module 'B64' {
export function fromByteArray(arr: Uint8Array): string;
export function toByteArray(str: string): Uint8Array;
}

View File

@ -6,9 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ImageDemo} from './index_common';
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
import {ImageDemo} from './index_common';
export function main() {
bootstrapWorkerApp(ImageDemo);
}

View File

@ -12,5 +12,5 @@ declare class Bitmap {
subsample(n: number): void;
dataURL(): string;
pixel:[any];
pixel: [any];
}

View File

@ -9,5 +9,5 @@
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapWorkerUi("loader.js");
bootstrapWorkerUi('loader.js');
}

View File

@ -7,10 +7,11 @@
*/
import {Component} from '@angular/core';
import {EventListener} from '@angular/core/src/facade/browser';
import {TimerWrapper} from '@angular/core/src/facade/async';
import {BitmapService} from './services/bitmap';
import {EventListener} from '@angular/core/src/facade/browser';
import {FileReader, Uint8ArrayWrapper} from './file_api';
import {BitmapService} from './services/bitmap';
@Component({selector: 'image-demo', viewProviders: [BitmapService], templateUrl: 'image_demo.html'})
@ -23,7 +24,7 @@ export class ImageDemo {
uploadFiles(files: any /** TODO #9100 */) {
for (var i = 0; i < files.length; i++) {
var reader = new FileReader();
reader.addEventListener("load", this.handleReaderLoad(reader));
reader.addEventListener('load', this.handleReaderLoad(reader));
reader.readAsArrayBuffer(files[i]);
}
}

View File

@ -12,10 +12,7 @@ declare var base64js: any /** TODO #9100 */;
// Temporary fix for Typescript issue #4220 (https://github.com/Microsoft/TypeScript/issues/4220)
// var _ImageData: (width: number, height: number) => void = <any>postMessage;
var _ImageData: {
prototype: ImageData, new (width: number, height: number): ImageData;
}
= ImageData;
var _ImageData: {prototype: ImageData, new (width: number, height: number): ImageData;} = ImageData;
// This class is based on the Bitmap examples at:
// http://www.i-programmer.info/projects/36-web/6234-reading-a-bmp-file-in-javascript.html
@ -71,7 +68,7 @@ export class BitmapService {
return imageData;
}
private _swap(data: Uint8Array | Uint8ClampedArray | number[], index1: number, index2: number) {
private _swap(data: Uint8Array|Uint8ClampedArray|number[], index1: number, index2: number) {
var temp = data[index1];
data[index1] = data[index2];
data[index2] = temp;
@ -83,22 +80,22 @@ export class BitmapService {
var numFileBytes = this._getLittleEndianHex(imageData.width * imageData.height);
var w = this._getLittleEndianHex(imageData.width);
var h = this._getLittleEndianHex(imageData.height);
return 'BM' + // Signature
numFileBytes + // size of the file (bytes)*
'\x00\x00' + // reserved
'\x00\x00' + // reserved
'\x36\x00\x00\x00' + // offset of where BMP data lives (54 bytes)
'\x28\x00\x00\x00' + // number of remaining bytes in header from here (40 bytes)
w + // the width of the bitmap in pixels*
h + // the height of the bitmap in pixels*
'\x01\x00' + // the number of color planes (1)
'\x20\x00' + // 32 bits / pixel
'\x00\x00\x00\x00' + // No compression (0)
'\x00\x00\x00\x00' + // size of the BMP data (bytes)*
'\x13\x0B\x00\x00' + // 2835 pixels/meter - horizontal resolution
'\x13\x0B\x00\x00' + // 2835 pixels/meter - the vertical resolution
'\x00\x00\x00\x00' + // Number of colors in the palette (keep 0 for 32-bit)
'\x00\x00\x00\x00'; // 0 important colors (means all colors are important)
return 'BM' + // Signature
numFileBytes + // size of the file (bytes)*
'\x00\x00' + // reserved
'\x00\x00' + // reserved
'\x36\x00\x00\x00' + // offset of where BMP data lives (54 bytes)
'\x28\x00\x00\x00' + // number of remaining bytes in header from here (40 bytes)
w + // the width of the bitmap in pixels*
h + // the height of the bitmap in pixels*
'\x01\x00' + // the number of color planes (1)
'\x20\x00' + // 32 bits / pixel
'\x00\x00\x00\x00' + // No compression (0)
'\x00\x00\x00\x00' + // size of the BMP data (bytes)*
'\x13\x0B\x00\x00' + // 2835 pixels/meter - horizontal resolution
'\x13\x0B\x00\x00' + // 2835 pixels/meter - the vertical resolution
'\x00\x00\x00\x00' + // Number of colors in the palette (keep 0 for 32-bit)
'\x00\x00\x00\x00'; // 0 important colors (means all colors are important)
}
private _BMPToImageData(bmp: BitmapFile): ImageData {
@ -172,18 +169,10 @@ export class BitmapService {
interface BitmapFile {
fileHeader: {
bfType: number;
bfSize: number;
bfReserved1: number;
bfReserved2: number;
bfOffBits: number;
bfType: number; bfSize: number; bfReserved1: number; bfReserved2: number; bfOffBits: number;
};
infoHeader: {
biSize: number;
biWidth: number;
biHeight: number;
biPlanes: number;
biBitCount: number;
biSize: number; biWidth: number; biHeight: number; biPlanes: number; biBitCount: number;
biCompression: number;
biSizeImage: number;
biXPelsPerMeter: number;

View File

@ -6,9 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {InputCmp} from './index_common';
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
import {InputCmp} from './index_common';
export function main() {
bootstrapWorkerApp(InputCmp);
}

View File

@ -9,5 +9,5 @@
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapWorkerUi("loader.js");
bootstrapWorkerUi('loader.js');
}

View File

@ -23,8 +23,8 @@ import {Component} from '@angular/core';
`
})
export class InputCmp {
inputVal = "";
textareaVal = "";
inputVal = '';
textareaVal = '';
inputChanged(e: any /** TODO #9100 */) { this.inputVal = e.target.value; }

View File

@ -6,9 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {HelloCmp} from './index_common';
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
import {HelloCmp} from './index_common';
export function main() {
bootstrapWorkerApp(HelloCmp);
}

View File

@ -9,5 +9,5 @@
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapWorkerUi("loader.js");
bootstrapWorkerUi('loader.js');
}

View File

@ -6,9 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Renderer, ElementRef, Component, Directive, Injectable} from '@angular/core';
import {Component, Directive, ElementRef, Injectable, Renderer} from '@angular/core';
import {StringWrapper} from '@angular/core/src/facade/lang';
// A service available to the Injector, used by the HelloCmp component.
@Injectable()
export class GreetingService {
@ -60,5 +61,7 @@ export class HelloCmp {
changeGreeting(): void { this.greeting = 'howdy'; }
onKeyDown(event: any /** TODO #9100 */): void { this.lastKey = StringWrapper.fromCharCode(event.keyCode); }
onKeyDown(event: any /** TODO #9100 */): void {
this.lastKey = StringWrapper.fromCharCode(event.keyCode);
}
}

View File

@ -7,35 +7,33 @@
*/
import {PlatformRef} from '@angular/core';
import {UiArguments, FnArg, PRIMITIVE, ClientMessageBrokerFactory} from '@angular/platform-browser';
import {bootstrapWorkerUi} from "@angular/platform-browser-dynamic";
import {ClientMessageBrokerFactory, FnArg, PRIMITIVE, UiArguments} from '@angular/platform-browser';
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
const ECHO_CHANNEL = "ECHO";
const ECHO_CHANNEL = 'ECHO';
export function main() {
bootstrapWorkerUi("loader.js").then(afterBootstrap);
bootstrapWorkerUi('loader.js').then(afterBootstrap);
}
function afterBootstrap(ref: PlatformRef) {
let brokerFactory: ClientMessageBrokerFactory = ref.injector.get(ClientMessageBrokerFactory);
var broker = brokerFactory.createMessageBroker(ECHO_CHANNEL, false);
document.getElementById("send_echo")
.addEventListener("click", (e) => {
var val = (<HTMLInputElement>document.getElementById("echo_input")).value;
// TODO(jteplitz602): Replace default constructors with real constructors
// once they're in the .d.ts file (#3926)
var args = new UiArguments("echo");
args.method = "echo";
var fnArg = new FnArg(val, PRIMITIVE);
fnArg.value = val;
fnArg.type = PRIMITIVE;
args.args = [fnArg];
document.getElementById('send_echo').addEventListener('click', (e) => {
var val = (<HTMLInputElement>document.getElementById('echo_input')).value;
// TODO(jteplitz602): Replace default constructors with real constructors
// once they're in the .d.ts file (#3926)
var args = new UiArguments('echo');
args.method = 'echo';
var fnArg = new FnArg(val, PRIMITIVE);
fnArg.value = val;
fnArg.type = PRIMITIVE;
args.args = [fnArg];
broker.runOnService(args, PRIMITIVE)
.then((echo_result: string) => {
document.getElementById("echo_result").innerHTML =
`<span class='response'>${echo_result}</span>`;
});
});
broker.runOnService(args, PRIMITIVE).then((echo_result: string) => {
document.getElementById('echo_result').innerHTML =
`<span class='response'>${echo_result}</span>`;
});
});
}

View File

@ -6,17 +6,17 @@
* found in the LICENSE file at https://angular.io/license
*/
import {PromiseWrapper} from '@angular/core/src/facade/async';
import {Component} from '@angular/core';
import {ServiceMessageBrokerFactory, PRIMITIVE} from '@angular/platform-browser';
import {PromiseWrapper} from '@angular/core/src/facade/async';
import {PRIMITIVE, ServiceMessageBrokerFactory} from '@angular/platform-browser';
const ECHO_CHANNEL = "ECHO";
const ECHO_CHANNEL = 'ECHO';
@Component({selector: 'app', template: "<h1>WebWorker MessageBroker Test</h1>"})
@Component({selector: 'app', template: '<h1>WebWorker MessageBroker Test</h1>'})
export class App {
constructor(private _serviceBrokerFactory: ServiceMessageBrokerFactory) {
var broker = _serviceBrokerFactory.createMessageBroker(ECHO_CHANNEL, false);
broker.registerMethod("echo", [PRIMITIVE], this._echo, PRIMITIVE);
broker.registerMethod('echo', [PRIMITIVE], this._echo, PRIMITIVE);
}
private _echo(val: string) {

View File

@ -7,8 +7,8 @@
*/
import {WORKER_UI_LOCATION_PROVIDERS} from '@angular/platform-browser';
import {bootstrapWorkerUi} from "@angular/platform-browser-dynamic";
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapWorkerUi("loader.js", WORKER_UI_LOCATION_PROVIDERS);
bootstrapWorkerUi('loader.js', WORKER_UI_LOCATION_PROVIDERS);
}

View File

@ -6,21 +6,21 @@
* found in the LICENSE file at https://angular.io/license
*/
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
import {Component, NgModule} from '@angular/core';
import {Start} from './components/start';
import {WORKER_APP_LOCATION_PROVIDERS, WorkerAppModule} from '@angular/platform-browser';
import {Router, RouterModule, provideRoutes} from '@angular/router';
import {About} from './components/about';
import {Contact} from './components/contact';
import {Router, RouterModule, provideRoutes} from '@angular/router';
import {WorkerAppModule, WORKER_APP_LOCATION_PROVIDERS} from '@angular/platform-browser';
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
import {Start} from './components/start';
@Component({selector: 'app', templateUrl: 'app.html'})
export class App {
}
export const ROUTES = [
{path: '', component: Start},
{path: 'contact', component: Contact},
{path: '', component: Start}, {path: 'contact', component: Contact},
{path: 'about', component: About}
];

View File

@ -6,9 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {TodoApp} from './index_common';
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
import {TodoApp} from './index_common';
export function main() {
bootstrapWorkerApp(TodoApp);
}

View File

@ -9,5 +9,5 @@
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapWorkerUi("loader.js");
bootstrapWorkerUi('loader.js');
}

View File

@ -6,8 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/
import {FORM_DIRECTIVES, NgFor} from '@angular/common';
import {Component} from '@angular/core';
import {NgFor, FORM_DIRECTIVES} from '@angular/common';
import {Store, Todo, TodoFactory} from './services/TodoStore';
@Component({
@ -27,7 +28,7 @@ export class TodoApp {
enterTodo(): void {
this.addTodo(this.inputValue);
this.inputValue = "";
this.inputValue = '';
}
doneEditing($event: any /** TODO #9100 */, todo: Todo): void {