mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 21:40:21 +00:00
Add types for ccapture.js (#37643)
* Add types for ccapture.js * Make types global * Remove package ref
This commit is contained in:
committed by
Sheetal Nandi
parent
29f705fd9b
commit
c161e2d2b5
@@ -0,0 +1,6 @@
|
||||
const canvas = document.createElement('canvas');
|
||||
const capturer = new CCapture({ format: 'webm' });
|
||||
capturer.start(); // $ExpectType void
|
||||
capturer.capture(canvas); // $ExpectType void
|
||||
capturer.stop(); // $ExpectType void
|
||||
capturer.save(); // $ExpectType void
|
||||
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
// Type definitions for ccapture.js 1.1
|
||||
// Project: https://github.com/spite/ccapture.js#readme
|
||||
// Definitions by: Sam Alexander <https://github.com/samalexander>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class CCapture {
|
||||
constructor(settings: CCapture.Settings);
|
||||
|
||||
start(): void;
|
||||
|
||||
capture(canvas: HTMLElement): void;
|
||||
|
||||
stop(): void;
|
||||
|
||||
save(cb?: (blob: Blob) => void): void;
|
||||
}
|
||||
|
||||
declare namespace CCapture {
|
||||
interface Settings {
|
||||
/**
|
||||
* Target framerate for the capture
|
||||
*/
|
||||
framerate?: number;
|
||||
/**
|
||||
* Super-sampling of frames to create a motion-blurred frame (0 or 1 make no effect)
|
||||
*/
|
||||
motionBlurFrames?: number;
|
||||
format: "webm" | "gif" | "png" | "jpg" | "ffmpegserver";
|
||||
/**
|
||||
* Quality for webm/jpg
|
||||
*/
|
||||
quality?: number;
|
||||
/**
|
||||
* Name of the files to be exported. if no name is provided, a GUID will be generated
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Dumps info on the console
|
||||
*/
|
||||
verbose?: boolean;
|
||||
/**
|
||||
* Adds a widget with capturing info
|
||||
*/
|
||||
display?: boolean;
|
||||
/**
|
||||
* Automatically stops and downloads when reaching that time (seconds).
|
||||
* Very convenient for long captures: set it and forget it (remember autoSaveTime!)
|
||||
*/
|
||||
timeLimit?: number;
|
||||
/**
|
||||
* It will automatically download the captured data every n seconds (only available for webm/png/jpg)
|
||||
*/
|
||||
autoSaveTime?: number;
|
||||
/**
|
||||
* Skip to that mark (seconds)
|
||||
*/
|
||||
startTime?: number;
|
||||
/**
|
||||
* Path to the gif worker script
|
||||
*/
|
||||
workersPath?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ccapture.js-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user