@capacitor/app
Version:
The App API handles high level App state and events.For example, this API emits events when the app enters and leaves the foreground, handles deeplinks, opens other apps, and manages persisted plugin state.
35 lines • 1.06 kB
JavaScript
import { WebPlugin } from '@capacitor/core';
export class AppWeb extends WebPlugin {
constructor() {
super();
this.handleVisibilityChange = () => {
const data = {
isActive: document.hidden !== true,
};
this.notifyListeners('appStateChange', data);
if (document.hidden) {
this.notifyListeners('pause', null);
}
else {
this.notifyListeners('resume', null);
}
};
document.addEventListener('visibilitychange', this.handleVisibilityChange, false);
}
exitApp() {
throw this.unimplemented('Not implemented on web.');
}
async getInfo() {
throw this.unimplemented('Not implemented on web.');
}
async getLaunchUrl() {
return { url: '' };
}
async getState() {
return { isActive: document.hidden !== true };
}
async minimizeApp() {
throw this.unimplemented('Not implemented on web.');
}
}
//# sourceMappingURL=web.js.map