dom-capture
Advanced tools
Comparing version 1.0.1 to 1.0.3
/** | ||
* Created by rockyl on 2021/1/26. | ||
*/ | ||
export var debugMode = window['html-shot/debug-mode'] || false; | ||
export var debugMode = window['dom-capture/debug-mode'] || false; |
@@ -12,2 +12,2 @@ /** | ||
*/ | ||
export declare function htmlShot(el?: HTMLElement, options?: RenderOptions, callback?: (HTMLCanvasElement: any) => void): Promise<HTMLCanvasElement | string>; | ||
export declare function capture(el?: HTMLElement, options?: RenderOptions, callback?: (HTMLCanvasElement: any) => void): Promise<HTMLCanvasElement | string>; |
@@ -13,4 +13,4 @@ /** | ||
*/ | ||
export function htmlShot(el, options, callback) { | ||
export function capture(el, options, callback) { | ||
return toCanvas(parseDom(el), options, callback); | ||
} |
{ | ||
"name": "dom-capture", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -5,9 +5,11 @@ # HTML截图 | ||
## Install | ||
`yarn add html-shot` | ||
`yarn add dom-capture` | ||
or | ||
`npm i html-shot` | ||
`npm i dom-capture` | ||
## Usage | ||
```js | ||
const result = await htmlShot(document.getElementById('poster')); | ||
import {capture} from 'dom-capture' | ||
const result = await capture(document.getElementById('poster')); | ||
let img = new Image(); | ||
@@ -19,10 +21,10 @@ img.src = result; | ||
## RenderOptions | ||
| 名称 | 类型 | 必须 | 默认值 | 说明 | | ||
| :---- | :---- | :---- | :---- | :---- | | ||
| `type` | 'canvas' | 'jpeg' | 'png' | 否 | 'png' | 导出类型 | | ||
| `qaulity` | number | 否 | 0.7 | 导出图片质量 | | ||
| 名称 | 类型 | 必须 | 默认值 | 说明 | | ||
|:----------|:---------------------------------------------------|:----|:-------|:-------| | ||
| `type` | 'canvas' | 'jpeg' | 'png' | 'blob' | 否 | 'png' | 导出类型 | | ||
| `qaulity` | number | 否 | 0.7 | 导出图片质量 | | ||
## 开启调试 | ||
```js | ||
window['html-shot/debug-mode'] = true | ||
window['dom-capture/debug-mode'] = true | ||
``` | ||
@@ -29,0 +31,0 @@ |
24527
43