1

i am developing an ionic app so i want to use the ionic storage module to store data on the device.

Parse is the backend so i have to tell the parse SDK that it should use the Ionic Storage. I build a StorageController like the included react-native one the use the ionic storage, but can't find a way to set the StorageController without cloning the SDK, alter Storage.js and add another else clause

if (process.env.PARSE_BUILD === 'react-native') {
  CoreManager.setStorageController(require('./StorageController.react-native'));
} else if (process.env.PARSE_BUILD === 'ionic') {
  CoreManager.setStorageController(require('./StorageController.ionic'));
} else if (process.env.PARSE_BUILD === 'browser') {
  CoreManager.setStorageController(require('./StorageController.browser'));
} else {
  CoreManager.setStorageController(require('./StorageController.default'));
}

is there a way to call CoreManager.setStorageController on the fly while parse initialisation?

fastr.de
  • 1,497
  • 14
  • 23

1 Answers1

1

I think you should be able to do this:

const Parse = require('parse');
const ionicController = require('./StorageController.ionic');

Parse.CoreManager.setStorageController(ionicController);
Arthur Cinader
  • 1,547
  • 1
  • 12
  • 22
  • 1
    I have to cast Parse to any because it's TypeScript and CoreManager is not in the definition file but it works this way! – fastr.de Oct 29 '19 at 09:46