-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add's a slow process to the Kitchen Sink demo
- Loading branch information
Showing
11 changed files
with
125 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
kitchen-sink-demo/src/app/demos/leaky-faucet/components/leaky-faucet.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { LeakyFaucetComponent } from './leaky-faucet.component'; | ||
|
||
describe('LeakyFaucetComponent', () => { | ||
let component: LeakyFaucetComponent; | ||
let fixture: ComponentFixture<LeakyFaucetComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ LeakyFaucetComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LeakyFaucetComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
51 changes: 51 additions & 0 deletions
51
kitchen-sink-demo/src/app/demos/leaky-faucet/components/leaky-faucet.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'leaky-faucet', | ||
template: ` | ||
<div> | ||
<p>{{ isDripping ? 'The faucet is dripping' : 'Faucet is not dripping' }}</p> | ||
<button type="button" class="btn btn-danger" (click)="toggleLeak()"> | ||
{{ isDripping ? 'Stop dripping' : 'Start drip' }} (calls a recursive function using setTimeout) | ||
</button> | ||
<div class="drip">Faucet: {{ drip }}</div> | ||
</div> | ||
` | ||
}) | ||
export class LeakyFaucetComponent { | ||
isDripping = false; | ||
drip = 'start the drip'; | ||
dripRate = 50; | ||
|
||
toggleLeak() { | ||
if (!this.isDripping) { | ||
return this.startLeak(); | ||
} | ||
return this.stopLeak(); | ||
} | ||
|
||
private startLeak() { | ||
this.isDripping = true; | ||
const message = 'This is a very fast dripping faucet!'; | ||
this.nextDrip(message); | ||
} | ||
|
||
private stopLeak() { | ||
this.isDripping = false; | ||
} | ||
|
||
private nextDrip(message: string) { | ||
setTimeout(() => { | ||
if (!this.isDripping) { | ||
return; | ||
} | ||
this.drip = message; | ||
if (message.length > 0) { | ||
this.nextDrip(message.slice(0, -1)); | ||
return; | ||
} | ||
this.drip = ' fixed '; | ||
this.stopLeak(); | ||
}, this.dripRate); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { LeakyFaucetComponent } from './components/leaky-faucet.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { enableProdMode, NgZone } from '@angular/core'; | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
|
||
import { AppModule } from './app/app.module'; | ||
import { environment } from './environments/environment'; | ||
|
||
// @todo: how to not include in prod bundle? | ||
import { auguryBootstrap } from '@augury/core'; | ||
import { OverlayHealthIndicator } from '../../../augury-labs/packages/plugins/overlay-health-indicator/src'; | ||
|
||
auguryBootstrap({ | ||
platform: platformBrowserDynamic, | ||
ngModule: AppModule, | ||
NgZone, | ||
plugins: [ | ||
// new PerformanceProfilerPlugin(), | ||
// new PopoutZoneMonitor(), | ||
// new c.CDHeatMap(), | ||
new OverlayHealthIndicator(), | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters