Looking to utilize capacitor/app in order to determine the state (background or active) of my iOS app. My project is built on Clojurescript, so I need to convert the following javascript code into a clojurescript equivalent.
- Javascript
import { App } from '@capacitor/app';
App.addListener('appStateChange', ({ isActive }) => {
console.log('App state changed. Is active?', isActive);
});
- Clojurescript translation
(ns js.sample
(:require ["@capacitor/app" :refer [App]]))
(.addListener App "appStateChange"
#((fn [isActive]
(js/console.log isActive))))
Expecting to receive isActive
as either true
or false
, but consistently getting an output of undefined
. What could be causing this issue with my code? Thank you for any assistance.