Skip to content

Instantly share code, notes, and snippets.

@thomhines
thomhines / example.js
Last active April 18, 2020 21:57
Capacitor iosMotion - Simple, partially-functional workaround for Capacitor Motion plugin (uses Native API instead of Web API). Place the .swift and .h files in the root of your App folder in Xcode, then add the javascript stuff to your app's code.
// Register the plugin with Capacitor
import { Plugins } from '@capacitor/core';
const { Keyboard } = Plugins;
// ORIENTATION
// Start tracking device orientation. This must be run in order for the following event listener to work
iosMotion.getOrientation()