Merge pull request #22266 from broder/cordova-univeral-links-plugin

Add typings for cordova-universal-links-plugin
This commit is contained in:
Arthur Ozga
2017-12-20 10:44:45 -08:00
committed by GitHub
4 changed files with 61 additions and 0 deletions
@@ -0,0 +1,16 @@
const newsEventname = 'openNewsListPage';
universalLinks.subscribe(newsEventname, onNewsListPageRequested);
function onNewsListPageRequested(eventData: universalLinks.EventData) {
alert('Did launch application with news link: ' + eventData.url);
}
universalLinks.unsubscribe('openNewsListPage');
universalLinks.subscribe(null, onOtherLinkRequested);
function onOtherLinkRequested(eventData: universalLinks.EventData) {
alert('Did launch application with other link: ' + eventData.url);
}
universalLinks.unsubscribe(null);
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for cordova-universal-links-plugin 1.2
// Project: https://github.com/nordnet/cordova-universal-links-plugin#readme
// Definitions by: David Broder-Rodgers <https://github.com/broder>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace universalLinks {
function subscribe(eventName: string | null, callback: (data: EventData) => void): void;
function unsubscribe(eventName: string | null): void;
interface EventData {
url: string;
scheme: string;
host: string;
path: string;
params: { [key: string]: string };
hash: string;
}
}
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cordova-universal-links-plugin-tests.ts"
]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}