mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #21847 from Yitzchok/master
types for npm package jschannel
This commit is contained in:
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
// Type definitions for jschannel 1.0
|
||||
// Project: https://github.com/yochannah/jschannel
|
||||
// Definitions by: Yitzchok Gottlieb <https://github.com/yitzchok>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export as namespace Channel;
|
||||
|
||||
export function build(config: ChannelConfiguration): MessagingChannel;
|
||||
|
||||
export interface MessagingChannel {
|
||||
unbind: (method: string, doNotPublish?: boolean) => boolean;
|
||||
bind: (method: string, callback?: (transaction: MessageTransaction, params: any) => void, doNotPublish?: boolean) => MessagingChannel;
|
||||
call: (message: Message) => void;
|
||||
notify: (message: Message) => void;
|
||||
destroy: () => void;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
method: string;
|
||||
success?: (result: any) => void;
|
||||
params?: any;
|
||||
timeout?: number;
|
||||
error?: (error: any, message: string) => void;
|
||||
}
|
||||
|
||||
export interface ChannelConfiguration {
|
||||
window: any;
|
||||
origin: string;
|
||||
scope: string;
|
||||
debugOutput?: boolean;
|
||||
postMessageObserver?: (origin: string, message: Message) => void;
|
||||
gotMessageObserver?: (origin: string, message: Message) => void;
|
||||
onReady?: (channel: MessagingChannel) => void;
|
||||
reconnect?: boolean;
|
||||
publish?: boolean;
|
||||
remote?: string | ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
export interface MessageTransaction {
|
||||
delayReturn: (delay: boolean) => boolean;
|
||||
complete: (result: any) => void;
|
||||
error: (error: any, message: string) => void;
|
||||
invoke: (callbackName: string, params: any) => void;
|
||||
completed: () => boolean;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { build } from 'jschannel';
|
||||
|
||||
build({ window: null, origin: "*", scope: "testScope"});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jschannel-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user