mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
chunked-dc: Provides its own types (#22397)
This commit is contained in:
@@ -150,6 +150,12 @@
|
||||
"sourceRepoURL": "https://github.com/mapbox/cheap-ruler",
|
||||
"asOfVersion": "2.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "chunked-dc",
|
||||
"typingsPackageName": "chunked-dc",
|
||||
"sourceRepoURL": "https://github.com/saltyrtc/chunked-dc-js",
|
||||
"asOfVersion": "0.2.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "commander",
|
||||
"typingsPackageName": "commander",
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Chunker
|
||||
|
||||
let chunker = new Chunker(1337, Uint8Array.of(1, 2, 3), 2);
|
||||
for (const chunk of chunker) {
|
||||
// Do smoething with chunk
|
||||
}
|
||||
while (chunker.hasNext) {
|
||||
const chunk = chunker.next().value;
|
||||
}
|
||||
|
||||
// Unchunker
|
||||
|
||||
let unchunker = new Unchunker();
|
||||
unchunker.onMessage = (message: Uint8Array, context: any[]) => {
|
||||
// Do something with the received message
|
||||
};
|
||||
let chunk = Uint8Array.of(1, 2).buffer;
|
||||
unchunker.add(chunk);
|
||||
unchunker.gc(1024);
|
||||
Vendored
-53
@@ -1,53 +0,0 @@
|
||||
// Type definitions for chunked-dc 0.1
|
||||
// Project: https://github.com/saltyrtc/chunked-dc-js
|
||||
// Definitions by: Danilo Bargen <https://github.com/dbrgn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Interfaces
|
||||
declare namespace chunkedDc {
|
||||
/** common.ts */
|
||||
|
||||
interface CommonStatic {
|
||||
HEADER_LENGTH: number;
|
||||
}
|
||||
|
||||
/** chunker.ts */
|
||||
|
||||
interface Chunker extends IterableIterator<Uint8Array> {
|
||||
hasNext: boolean;
|
||||
next(): IteratorResult<Uint8Array>;
|
||||
[Symbol.iterator](): IterableIterator<Uint8Array>;
|
||||
}
|
||||
|
||||
interface ChunkerStatic {
|
||||
new(id: number, message: Uint8Array, chunkSize: number): Chunker;
|
||||
}
|
||||
|
||||
/** unchunker.ts */
|
||||
|
||||
type MessageListener = (message: Uint8Array, context?: any) => void;
|
||||
|
||||
interface Unchunker {
|
||||
onMessage: MessageListener;
|
||||
add(chunk: ArrayBuffer, context?: any): void;
|
||||
gc(maxAge: number): number;
|
||||
}
|
||||
|
||||
interface UnchunkerStatic {
|
||||
new(): Unchunker;
|
||||
}
|
||||
|
||||
/** main.ts */
|
||||
|
||||
interface Standalone {
|
||||
Chunker: ChunkerStatic;
|
||||
Unchunker: UnchunkerStatic;
|
||||
}
|
||||
}
|
||||
|
||||
// Entry point for the packed ES5 version:
|
||||
declare var chunkedDc: chunkedDc.Standalone;
|
||||
|
||||
// Entry point for the ES2015 version:
|
||||
declare var Chunker: chunkedDc.ChunkerStatic;
|
||||
declare var Unchunker: chunkedDc.UnchunkerStatic;
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chunked-dc-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user