member_webapp/@overflow/discovery/component/search-result.component.ts
2018-05-31 20:53:11 +09:00

45 lines
807 B
TypeScript

import {
AfterContentInit, Component, Input,
EventEmitter,
Output,
OnChanges,
SimpleChanges
} from '@angular/core';
import { Anim } from './animation';
@Component({
selector: 'of-discovery-result',
templateUrl: './search-result.component.html',
animations: Anim
})
export class SearchResultComponent implements OnChanges {
@Output() stop = new EventEmitter();
@Input() started: boolean;
tempData = [];
tempTimer;
constructor(
) {
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['started'] && changes['started'].currentValue) {
this.tempTimer = setInterval(() => { this.tempFunc(); }, 1000);
}
}
onStop() {
this.stop.emit();
clearInterval(this.tempTimer);
}
tempFunc() {
this.tempData.push({
name: 'aaa'
});
}
}