1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-10 22:11:50 +02:00

Chore: Web: Simplify accessing certain global APIs in dev mode (#12308)

This commit is contained in:
Henry Heino
2025-05-19 14:54:54 -07:00
committed by GitHub
parent dca28f8c2a
commit e2ef406aa2

View File

@@ -1,5 +1,15 @@
import { AppRegistry } from 'react-native';
import Root from './root';
import Setting from '@joplin/lib/models/Setting';
import Note from '@joplin/lib/models/Note';
import Folder from '@joplin/lib/models/Folder';
import CommandService from '@joplin/lib/services/CommandService';
import RevisionService from '@joplin/lib/services/RevisionService';
import MigrationService from '@joplin/lib/services/MigrationService';
import DecryptionWorker from '@joplin/lib/services/DecryptionWorker';
import PluginService from '@joplin/lib/services/plugins/PluginService';
import Tag from '@joplin/lib/models/Tag';
import SearchEngine from '@joplin/lib/services/search/SearchEngine';
require('./web/rnVectorIconsSetup.js');
@@ -12,6 +22,26 @@ interface ExtendedNavigator extends Navigator {
}
declare const navigator: ExtendedNavigator;
// Add properties useful for debugging from the console window:
interface ExtendedWindow extends Window {
joplin: unknown;
}
declare const window: ExtendedWindow;
if (__DEV__) {
window.joplin = {
Setting,
Note,
Folder,
Tag,
revisionService: RevisionService.instance(),
migrationService: MigrationService.instance(),
decryptionWorker: DecryptionWorker.instance(),
commandService: CommandService.instance(),
pluginService: PluginService.instance(),
searchEngine: SearchEngine.instance(),
};
}
// Should prevent the browser from auto-deleting background data.
const requestPersistentStorage = async () => {
if (!(await navigator.storage.persisted())) {