Docs
API: @mrbd/core
Framework-agnostic constants and browser helpers.
API: @mrbd/core
Install:
npm install @mrbd/coreConstants
MRBD_VIEWPORT_SIZEis{ width: 600, height: 600 }.MRBD_SAFE_MARGINis8.MRBD_MIN_TARGET_SIZEis88.DPADcontains the keyboard keys used by MRBD navigation.isDpadKey(key)checks whether a string is one of the supported keys.
Sensors
requestAndStartMrbdSensors(handlers)requests permission where required, attaches motion and orientation listeners, and returns a session withstop().MrbdOrientationincludesheading,tilt,roll, andabsolute.MrbdMotionincludes acceleration, acceleration including gravity, rotation rate, interval, and computedgForce.
Location
getCurrentMrbdPosition(options)wrapsnavigator.geolocation.getCurrentPosition.watchMrbdPosition(onPosition, onError, options)wrapsnavigator.geolocation.watchPositionand returns astop()handle.
Request detection
isMetaRayBanDisplayRequest(headers)checks whetherx-requested-withiscom.meta.smartglass.app.browser.getMrbdRequestedWithHeader(headers)reads the MRBD browser header from aRequest,Headers, header record, or iterable header entries.
Storage
readStoredJson(key, fallback, storage?)writeStoredJson(key, value, storage?)removeStoredValue(key, storage?)
All helpers are browser-safe at import time. They check browser APIs when called.