Decorator that subscribes to the current device type from the device service.
This decorator automatically updates the decorated property whenever the device type
changes (typically when the viewport is resized). The device type indicates roughly
how big the viewport is, not what actual device is being used. It's the recommended
approach over manual subscriptions as it handles subscription lifecycle automatically.
Returns
A PropertyDecorator that sets up automatic subscription to device type
Remarks
Subscribes to: Device service
Updates: The decorated property with DeviceType ('desktop', 'tablet', or 'phone')
Viewport-aware: Automatically updates when viewport size changes
Lifecycle: Automatically subscribes in connectedCallback and
unsubscribes in disconnectedCallback
Decorator that subscribes to the current device type from the device service.
This decorator automatically updates the decorated property whenever the device type changes (typically when the viewport is resized). The device type indicates roughly how big the viewport is, not what actual device is being used. It's the recommended approach over manual subscriptions as it handles subscription lifecycle automatically.
Returns
A PropertyDecorator that sets up automatic subscription to device type
Remarks
Subscribes to: Device service
Updates: The decorated property with DeviceType ('desktop', 'tablet', or 'phone')
Viewport-aware: Automatically updates when viewport size changes
Lifecycle: Automatically subscribes in
connectedCallbackand unsubscribes indisconnectedCallbackExample
Basic usage with Stencil component
Example
Conditional rendering based on device