mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
Update typings to use namespace
This commit is contained in:
@@ -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);
|
||||
|
||||
28
types/cordova-universal-links-plugin/index.d.ts
vendored
28
types/cordova-universal-links-plugin/index.d.ts
vendored
@@ -3,22 +3,16 @@
|
||||
// Definitions by: David Broder-Rodgers <https://github.com/broder>
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user