member_webapp/@overflow/discovery/component/search-result.component.ts

45 lines
807 B
TypeScript
Raw Normal View History

2018-05-30 09:39:26 +00:00
import {
AfterContentInit, Component, Input,
EventEmitter,
2018-05-30 14:05:58 +00:00
Output,
OnChanges,
SimpleChanges
2018-05-30 09:39:26 +00:00
} from '@angular/core';
2018-05-30 14:05:58 +00:00
import { Anim } from './animation';
2018-05-30 09:39:26 +00:00
@Component({
selector: 'of-discovery-result',
templateUrl: './search-result.component.html',
2018-05-30 14:05:58 +00:00
animations: Anim
2018-05-30 09:39:26 +00:00
})
2018-05-30 14:05:58 +00:00
export class SearchResultComponent implements OnChanges {
2018-05-30 09:39:26 +00:00
@Output() stop = new EventEmitter();
2018-05-30 14:05:58 +00:00
@Input() started: boolean;
tempData = [];
tempTimer;
2018-05-30 09:39:26 +00:00
constructor(
) {
}
2018-05-30 14:05:58 +00:00
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'
});
}
2018-05-30 09:39:26 +00:00
}