How to use the @ionic-native/core.wrap function in @ionic-native/core

To help you get started, we’ve selected a few @ionic-native/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / ionic-native / src / @ionic-native / plugins / photo-library / index.ts View on Github external
value(...args: any[]) {
        const wrappedObservable: Observable = wrap(
          this,
          methodName,
          opts
        ).apply(this, args);
        return new Observable((observer: Observer) => {
          const wrappedSubscription = wrappedObservable.subscribe({
            next: (x: any) => {
              observer.next(opts.resultTransform ? x[opts.resultTransform] : x);
              if (opts.resultFinalPredicate && x[opts.resultFinalPredicate]) {
                observer.complete();
              }
            },
            error: (err: any) => {
              observer.error(err);
            },
            complete: () => {