You can use bindCallbackto create an observable for a callback:
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/bindCallback';
...
.map((contentURI: string) => {
const bound = Observable.bindCallback((
path: string,
callback: (result: string) => void
) => this.$window.FilePath.resolveNativePath(path, callback));
return bound(contentURI);
})
...
I used the arrow function, so the argument types are explicit and therefore resolveNativePathcalled on this.$window.FilePath.
Function.prototype.bind, any TypeScript bindCallback.
RxJS 5. , , , 4. fromCallback.