Frontend Developer Manual / Version 2110
Table Of Contents
The device-detector
API brick stores device and orientation information to support responsive UIs.
Technical Description
The brick provides methods to read and update device relevant information of pseudo elements at the body defined by CSS media queries.
import { getLastDevice } from "@coremedia/brick-device-detector"; ... if (getLastDevice().type !== "mobile") { $cartPopup.toggleClass("cm-cart-popup--active"); } ...
Example 6.1. Shopping Cart Example
Note
Please note that this brick contains JavaScript
files, what will automatically be installed, if you add
the brick to your theme package.json
. See Section 5.3, “Using Bricks” to learn how to install a brick in your theme.