mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge pull request #28024 from ffflorian/websequencediagrams
Add types for websequencediagrams
This commit is contained in:
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for websequencediagrams 0.1
|
||||
// Project: https://github.com/hildjj/node-websequencediagrams
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export type OutputType = 'png' | 'svg' | 'pdf';
|
||||
export type Style = 'default' | 'earth' | 'modern-blue' | 'mscgen' | 'omegapple' | 'qsd' | 'rose' | 'roundgreen' | 'napkin' | 'magazine' | 'vs2010' | 'patent';
|
||||
export type diagramCallback = (error: Error | null, buffer?: Buffer, mimeType?: string) => void;
|
||||
export type diagramUrlCallback = (error: Error | null, url?: string) => void;
|
||||
|
||||
export const root: string;
|
||||
export const styles: Style[];
|
||||
|
||||
export function diagram(description: string | Buffer, style: Style | null, format: OutputType | null, callback: diagramCallback): void;
|
||||
export function diagram_url(description: string | Buffer, style: Style | null, format: OutputType | null, callback: diagramUrlCallback): void;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"websequencediagrams-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,18 @@
|
||||
import * as wsd from 'websequencediagrams';
|
||||
|
||||
wsd.diagram('Alice->Bob: message', 'modern-blue', 'png', (error, buffer, mimeType) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('Received MIME type:', mimeType);
|
||||
console.log('Received Buffer:', buffer);
|
||||
}
|
||||
});
|
||||
|
||||
wsd.diagram_url('Alice->Bob: message', 'modern-blue', 'png', (error, url) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('Received URL:', url);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user