Property media$ was marked as deprecated without any alternatives
See original GitHub issueI use the following code for defined if current media is desktop.
isDesktop$ = this._mediaObserver.media$.pipe(
map((mediaChange: MediaChange) => [ 'xs', 'sm' ].indexOf(mediaChange.mqAlias) === -1)
);
But in version 7.0.0-beta.24 property media$
was deprecated. If I try to use method asObservable
when I get array of media changes instead of one object. It doesn’t suit me because I need to match a few values with one media change.
I could not find some examples in documentation. What I should to do to avoid of using deprecated property?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Deprecated HTML elements (and what to use instead)
The <dir> tag has been deprecated in favor of several alternatives that serve the same purpose with even more functionality. The <li> element ......
Read more >Alternative for event's deprecated KeyboardEvent.which ...
When getting text input from the user, use the keypress event along with e.key; For shortcuts and other combinations, the built-in way is...
Read more >Deprecated Fields, and Fields Marked as Obsolete
In the latest version of Business Central, a number of fields have been deprecated in the current release or marked to be obsolete...
Read more >Deprecated APIs and features - Angular
This section lists all deprecated features, which includes template syntax, configuration options, and any other deprecations not listed in the Deprecated APIs ...
Read more >Deprecation warnings in legacy JavaScript code using ...
deprecation is the discouragement of use of some terminology, feature, design, or practice […] without completely removing it or prohibiting ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is how I have used it: Subscription.asObservable() .pipe( filter((changes: MediaChange[]) => changes.length > 0), map((changes: MediaChange[]) => changes[0]) ) .subscribe((change: MediaChange) => { if (change.mqAlias === ‘sm’ || change.mqAlias === ‘xs’) { // do something } else { // do something else } });
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.