Add package: openurl & openurl2 (#40065)

* add package: openurl & openurl2

* fix lint
This commit is contained in:
Felix Hao 2019-11-06 03:18:42 +08:00 committed by Nathan Shively-Sanders
parent 144b45d7c1
commit 2e2227cdde
8 changed files with 86 additions and 0 deletions

9
types/openurl/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for openurl 1.0
// Project: https://github.com/rauschma/openurl
// Definitions by: Felix Hao <https://github.com/felixhao28>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export function open(url: string, callback?: (err: Error) => void): void;
export function mailto(recipients: string[], fields: {[key: string]: string}, recipientsSeparator?: string, callback?: (err: Error) => void): void;

View File

@ -0,0 +1,8 @@
import { open, mailto } from "openurl";
open("http://rauschma.de", (e) => {
console.log(e.message);
});
mailto(
["john@example.com", "jane@example.com"],
{ subject: "Hello!", body: "This is\nan automatically sent email!\n" }
);

View File

@ -0,0 +1,23 @@
{
"files": [
"index.d.ts",
"openurl-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

9
types/openurl2/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for openurl2 1.0
// Project: https://github.com/rauschma/openurl
// Definitions by: Felix Hao <https://github.com/felixhao28>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export function open(url: string, callback?: (err: Error) => void): void;
export function mailto(recipients: string[], fields: {[key: string]: string}, recipientsSeparator?: string, callback?: (err: Error) => void): void;

View File

@ -0,0 +1,8 @@
import { open, mailto } from "openurl2";
open("http://rauschma.de", (e) => {
console.log(e.message);
});
mailto(
["john@example.com", "jane@example.com"],
{ subject: "Hello!", body: "This is\nan automatically sent email!\n" }
);

View File

@ -0,0 +1,23 @@
{
"files": [
"index.d.ts",
"openurl2-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}