JLPluginDevice
A Jasonelle plugin that reports information about the device running the app.
Overview
JLPluginDevice exposes device details to JavaScript. Call it from the web view to learn the operating system, vendor, device type, orientation, and screen size.
Structure
| File | Role |
|---|---|
|
Native side – collects device information and responds to calls from JavaScript. |
|
JavaScript side – registers the plugin on |
How it works
-
The plugin is injected into the web view at document end and registers itself on
window.jasonelle.plugins.device. -
Call
window.jasonelle.plugins.device.info()from JavaScript; it returns a promise. -
The call is routed to
Plugin.swifthandle_call(args:callbackId:respond:), which resolves the promise with the device information.
Response
The promise resolves with an object like:
{
"status": "ok",
"os": { "name": "ios", "version": "18.1" },
"vendor": "apple",
"type": "iphone",
"orientation": "portrait",
"screen": { "width": 393, "height": 852 }
}
os.name is ios, macos, tvos, or watchos depending on the platform. type is ipad, iphone, or macos. orientation is a UIDeviceOrientation value and only meaningful on iOS.