import { Module } from '@rxdi/core';
import { ResponsiveService } from '@rxdi/ui-components/services';
@Module({
providers: [ResponsiveService]
})
export class CoreModule {}
Remember to always unsubscribe from observables!
import { html, LitElement, Component, css, property } from '@rxdi/lit-html';
import { Inject } from '@rxdi/core';
import { ResponsiveService } from '@rxdi/ui-components/services';
import { Subscription } from 'rxjs';
/**
* @customElement navbar-component
*/
@Component({
selector: 'navbar-component',
style: css``,
template(this: NavbarComponent) {
return html``;
}
})
export class NavbarComponent extends LitElement {
@Inject(ResponsiveService) private responsive: ResponsiveService;
@property() widthHeight: { width: number; height: number };
private subscription: Subscription = this.responsive
.combineBoth()
.subscribe(v => (this.widthHeight = v));
OnDestroy() {
if (this.subscription) {
this.subscription.unsubscribe();
}
}
}