mirror of
https://github.com/nolanlawson/blob-util.git
synced 2025-12-08 19:46:19 +00:00
prevent typedoc generating docs for private functions
This commit is contained in:
parent
9cec8a9893
commit
b5a1608a96
31
README.md
31
README.md
@ -565,37 +565,6 @@ blobUtil.imgSrcToDataURL('http://some-other-site.com/img.jpg', 'image/jpeg',
|
||||
**Returns:** `Promise`<`string`>
|
||||
Promise that resolves with the data URL string
|
||||
|
||||
___
|
||||
<a id="imgtocanvas"></a>
|
||||
|
||||
### `<Private>` imgToCanvas
|
||||
|
||||
▸ **imgToCanvas**(img: *`any`*): `HTMLCanvasElement`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| img | `any` |
|
||||
|
||||
**Returns:** `HTMLCanvasElement`
|
||||
|
||||
___
|
||||
<a id="loadimage"></a>
|
||||
|
||||
### `<Private>` loadImage
|
||||
|
||||
▸ **loadImage**(src: *`any`*, crossOrigin: *`any`*): `Promise`<`Object`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| src | `any` |
|
||||
| crossOrigin | `any` |
|
||||
|
||||
**Returns:** `Promise`<`Object`>
|
||||
|
||||
___
|
||||
<a id="revokeobjecturl"></a>
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"build-umd": "rollup -i lib/blob-util.js -f umd -n blobUtil -o dist/blob-util.js",
|
||||
"min": "uglifyjs dist/blob-util.js -mc > dist/blob-util.min.js",
|
||||
"doc": "run-s cleanup-doc gen-doc gen-readme cleanup-doc",
|
||||
"gen-doc": "typedoc --out docs-tmp --target ES6 --theme markdown --mdHideSources --excludePrivate src",
|
||||
"gen-doc": "typedoc --out docs-tmp --target ES6 --theme markdown --mdHideSources --excludePrivate --exclude private.ts src",
|
||||
"gen-readme": "node bin/write-docs-to-readme.js",
|
||||
"cleanup-doc": "rimraf docs-tmp"
|
||||
},
|
||||
|
||||
@ -14,39 +14,7 @@ declare var WebKitBlobBuilder: any
|
||||
/** @private */
|
||||
declare var webkitURL: any
|
||||
|
||||
/** @private */
|
||||
function loadImage (src, crossOrigin) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var img = new Image()
|
||||
if (crossOrigin) {
|
||||
img.crossOrigin = crossOrigin
|
||||
}
|
||||
img.onload = function () {
|
||||
resolve(img)
|
||||
}
|
||||
img.onerror = reject
|
||||
img.src = src
|
||||
})
|
||||
}
|
||||
|
||||
/** @private */
|
||||
function imgToCanvas (img) {
|
||||
var canvas = document.createElement('canvas')
|
||||
|
||||
canvas.width = img.width
|
||||
canvas.height = img.height
|
||||
|
||||
// copy the image contents to the canvas
|
||||
var context = canvas.getContext('2d')
|
||||
context.drawImage(
|
||||
img,
|
||||
0, 0,
|
||||
img.width, img.height,
|
||||
0, 0,
|
||||
img.width, img.height)
|
||||
|
||||
return canvas
|
||||
}
|
||||
import { loadImage, imgToCanvas } from './private'
|
||||
|
||||
/**
|
||||
* Shim for
|
||||
|
||||
36
src/private.ts
Normal file
36
src/private.ts
Normal file
@ -0,0 +1,36 @@
|
||||
// TODO: including these in blob-util.ts causes typedoc to generate docs for them,
|
||||
// even with --excludePrivate ¯\_(ツ)_/¯
|
||||
|
||||
/** @private */
|
||||
export function loadImage (src, crossOrigin) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var img = new Image()
|
||||
if (crossOrigin) {
|
||||
img.crossOrigin = crossOrigin
|
||||
}
|
||||
img.onload = function () {
|
||||
resolve(img)
|
||||
}
|
||||
img.onerror = reject
|
||||
img.src = src
|
||||
})
|
||||
}
|
||||
|
||||
/** @private */
|
||||
export function imgToCanvas (img) {
|
||||
var canvas = document.createElement('canvas')
|
||||
|
||||
canvas.width = img.width
|
||||
canvas.height = img.height
|
||||
|
||||
// copy the image contents to the canvas
|
||||
var context = canvas.getContext('2d')
|
||||
context.drawImage(
|
||||
img,
|
||||
0, 0,
|
||||
img.width, img.height,
|
||||
0, 0,
|
||||
img.width, img.height)
|
||||
|
||||
return canvas
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user