diff --git a/types/cordova-universal-links-plugin/cordova-universal-links-plugin-tests.ts b/types/cordova-universal-links-plugin/cordova-universal-links-plugin-tests.ts index e16254312b..1a6981b2e9 100644 --- a/types/cordova-universal-links-plugin/cordova-universal-links-plugin-tests.ts +++ b/types/cordova-universal-links-plugin/cordova-universal-links-plugin-tests.ts @@ -1,16 +1,16 @@ const newsEventname = 'openNewsListPage'; universalLinks.subscribe(newsEventname, onNewsListPageRequested); -function onNewsListPageRequested(eventData: EventData) { +function onNewsListPageRequested(eventData: universalLinks.EventData) { alert('Did launch application with news link: ' + eventData.url); } universalLinks.unsubscribe('openNewsListPage'); -window.universalLinks.subscribe(null, onOtherLinkRequested); +universalLinks.subscribe(null, onOtherLinkRequested); -function onOtherLinkRequested(eventData: EventData) { +function onOtherLinkRequested(eventData: universalLinks.EventData) { alert('Did launch application with other link: ' + eventData.url); } -window.universalLinks.unsubscribe(null); +universalLinks.unsubscribe(null); diff --git a/types/cordova-universal-links-plugin/index.d.ts b/types/cordova-universal-links-plugin/index.d.ts index 6b29c1a37e..98217a1b0a 100644 --- a/types/cordova-universal-links-plugin/index.d.ts +++ b/types/cordova-universal-links-plugin/index.d.ts @@ -3,22 +3,16 @@ // Definitions by: David Broder-Rodgers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface EventData { - url: string; - scheme: string; - host: string; - path: string; - params: { [key: string]: string }; - hash: string; -} +declare namespace universalLinks { + function subscribe(eventName: string | null, callback: (data: EventData) => void): void; + function unsubscribe(eventName: string | null): void; -interface UniversalLinks { - subscribe(eventName: string | null, callback: (data: EventData) => void): void; - unsubscribe(eventName: string | null): void; + interface EventData { + url: string; + scheme: string; + host: string; + path: string; + params: { [key: string]: string }; + hash: string; + } } - -interface Window { - universalLinks: UniversalLinks; -} - -declare var universalLinks: UniversalLinks;