diff --git a/.gitignore b/.gitignore index d2d968513..1e12dbb4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules/ .idea dist/ diff --git a/DEVELOPER.md b/DEVELOPER.md index 24857dc5c..e52ff352b 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -102,6 +102,58 @@ The `@Cordova` decorator has a few more options now. `clearFunction` is used in conjunction with the `observable` option and indicates the function to be called when the Observable is disposed. +### Updating index.ts + +For new plugins, you will need to update `/src/index.ts` to properly export your plugin and make it available for use. + +1. Import the plugin class into `index.ts`: + +`import {PluginClassName} from ./plugins/filenameForPlugin` + +No need to put the `.ts` extension on the filename. + +2. Add the plugin class name to the list in the `export` object: + +``` +export { + ActionSheet, + AdMob, + AndroidFingerprintAuth, + YourPluginClassName, + ... +} +``` + +3. Add the plugin class name to the `window['IonicNative']` object: + +``` +window['IonicNative'] = { + ActionSheet: ActionSheet, + AdMob: AdMob, + AndroidFingerprintAuth: AndroidFingerprintAuth, + YourPluginClassName: YourPluginClassName, + ... +``` + +4. If your plugin exports any other objects outside of the plugin class, add an export statement for the file: + +`export * from './plugins/filenameForPlugin';` + +No need to put the `.ts` extension on the filename. + +For example, `googlemaps.ts` exports a const outside of the plugin's main `GoogleMap` class: + +``` +export const GoogleMapsAnimation = { + BOUNCE: 'BOUNCE', + DROP: 'DROP' +}; +``` + +To properly export `GoogleMapsAnimation`, `index.ts` is updated with: + +`export * from './plugins/googlemaps';` + ### Testing your changes You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.