chunked-dc: Provides its own types (#22397)

This commit is contained in:
Andy
2017-12-21 07:23:52 -08:00
committed by GitHub
parent 8b10461a43
commit cf0576d627
5 changed files with 6 additions and 97 deletions
+6
View File
@@ -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",
-19
View File
@@ -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);
-53
View File
@@ -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;
-24
View File
@@ -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
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }