Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Created October 16, 2019 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjamincharity/af0ccdc2bc265a030ee5678f0dc65582 to your computer and use it in GitHub Desktop.
Save benjamincharity/af0ccdc2bc265a030ee5678f0dc65582 to your computer and use it in GitHub Desktop.
public readonly headerCellResizes: Observable<TsHeaderCellResizeEvent> | Observable<{}> = defer(() => {
if (this.headerCells && this.headerCells.length) {
return merge(...this.headerCells.map(cell => cell.resized));
}
// If there are any subscribers before `ngAfterViewInit`, `headerCells` may be undefined.
// In that case, return a stream that we'll replace with the real one once everything is in place.
return this.ngZone.onStable
.asObservable()
.pipe(take(1), switchMap(() => this.headerCellResizes));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment