Skip to content

Commit

Permalink
fix(3dtouch): fix implementation for onHomeIconPressed function
Browse files Browse the repository at this point in the history
closes #232
  • Loading branch information
ihadeed committed Jun 26, 2016
1 parent 4c6006b commit d2b2be6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/plugins/3dtouch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
declare var window: any;
/**
* @name 3DTouch
* @description
Expand Down Expand Up @@ -85,7 +86,15 @@ export class ThreeDeeTouch {
@Cordova({
observable: true
})
static onHomeIconPressed(): Observable<any> {return; }
static onHomeIconPressed(): Observable<any> {
return new Observable(observer => {
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
else {
observer.error('3dTouch plugin is not available.');
observer.complete();
}
});
}

/**
* UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
Expand Down

0 comments on commit d2b2be6

Please sign in to comment.