mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 00:12:53 +08:00
docs(readme): update readme
This commit is contained in:
parent
cedd6df423
commit
c113417878
31
README.md
31
README.md
@ -1,6 +1,5 @@
|
|||||||
[![Circle CI](https://circleci.com/gh/ionic-team/ionic-native.svg?style=shield)](https://circleci.com/gh/ionic-team/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) ![](https://img.shields.io/npm/v/@ionic-native/core.svg)
|
[![Circle CI](https://circleci.com/gh/ionic-team/ionic-native.svg?style=shield)](https://circleci.com/gh/ionic-team/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) ![](https://img.shields.io/npm/v/@ionic-native/core.svg)
|
||||||
|
|
||||||
|
|
||||||
# Ionic Native
|
# Ionic Native
|
||||||
|
|
||||||
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](https://ionicframework.com/) mobile app easy.
|
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](https://ionicframework.com/) mobile app easy.
|
||||||
@ -10,8 +9,9 @@ Ionic Native wraps plugin callbacks in a Promise or Observable, providing a comm
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Run following command to install Ionic Native in your project.
|
Run following command to install Ionic Native in your project.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @ionic-native/core --save
|
npm install @ionic-native/core
|
||||||
```
|
```
|
||||||
|
|
||||||
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
|
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
|
||||||
@ -92,8 +92,8 @@ Then create a new class that extends the `Camera` class with a mock implementati
|
|||||||
class CameraMock extends Camera {
|
class CameraMock extends Camera {
|
||||||
getPicture(options) {
|
getPicture(options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
resolve("BASE_64_ENCODED_DATA_GOES_HERE");
|
resolve('BASE_64_ENCODED_DATA_GOES_HERE');
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -101,9 +101,7 @@ class CameraMock extends Camera {
|
|||||||
Finally, override the previous `Camera` class in your `providers` for this module:
|
Finally, override the previous `Camera` class in your `providers` for this module:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
providers: [
|
providers: [{ provide: Camera, useClass: CameraMock }];
|
||||||
{ provide: Camera, useClass: CameraMock }
|
|
||||||
]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Here's the full example:
|
Here's the full example:
|
||||||
@ -126,37 +124,26 @@ class CameraMock extends Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [MyApp, HomePage],
|
||||||
MyApp,
|
imports: [BrowserModule, IonicModule.forRoot(MyApp)],
|
||||||
HomePage
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
BrowserModule,
|
|
||||||
IonicModule.forRoot(MyApp)
|
|
||||||
],
|
|
||||||
bootstrap: [IonicApp],
|
bootstrap: [IonicApp],
|
||||||
entryComponents: [
|
entryComponents: [MyApp, HomePage],
|
||||||
MyApp,
|
|
||||||
HomePage
|
|
||||||
],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: ErrorHandler, useClass: IonicErrorHandler },
|
{ provide: ErrorHandler, useClass: IonicErrorHandler },
|
||||||
{ provide: Camera, useClass: CameraMock }
|
{ provide: Camera, useClass: CameraMock }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Runtime Diagnostics
|
### Runtime Diagnostics
|
||||||
|
|
||||||
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
|
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
|
||||||
|
|
||||||
![img](https://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
|
![img](https://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
|
||||||
|
|
||||||
|
|
||||||
## Plugin Missing?
|
## Plugin Missing?
|
||||||
|
|
||||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||||
|
|
||||||
## Ionic v1 (AngularJS, Angular 1.x) support
|
## Ionic v1 (AngularJS, Angular 1.x) support
|
||||||
|
Loading…
Reference in New Issue
Block a user