@jasonsbarr/htdp-image
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"main": "./dist/index.cjs", | ||
@@ -11,0 +11,0 @@ "source": "./src/index.js", |
@@ -45,3 +45,3 @@ # HTDP/Image.js | ||
```html | ||
<script src="https://www.unpkg.com/@jasonsbarr/htdp-image@0.7.0/dist/index.umd.js"></script> | ||
<script src="https://www.unpkg.com/@jasonsbarr/htdp-image@0.7.1/dist/index.umd.js"></script> | ||
@@ -48,0 +48,0 @@ <script> |
@@ -50,2 +50,28 @@ import { | ||
/** | ||
* Makes a file image from a source URL | ||
* @param {string} src | ||
* @returns {ImageLib.FileImage} | ||
*/ | ||
export const imageURL = (src) => { | ||
const rawImage = document.createElement("img"); | ||
rawImage.src = src; | ||
return ImageLib.makeFileImage(src, rawImage); | ||
}; | ||
export const bitmapURL = imageURL; | ||
/** | ||
* Makes a file video from a source URL | ||
* @param {string} src | ||
* @returns {ImageLib.FileVideo} | ||
*/ | ||
export const videoURL = (src) => { | ||
const rawVideo = document.createElement("video"); | ||
rawVideo.src = src; | ||
return ImageLib.makeFileVideo(src, rawVideo); | ||
}; | ||
/** | ||
* Makes a simple text image with sensible defaults | ||
@@ -1301,2 +1327,14 @@ * @param {string} str | ||
export const isAngle = ImageLib.isAngle; | ||
export const isSideCount = ImageLib.isSideCount; | ||
export const isStepCount = ImageLib.isStepCount; | ||
export const isImage = ImageLib.isImage; | ||
export const imagesDifference = ImageLib.imageDifference; | ||
export const imagesEqual = ImageLib.imageEquals; | ||
/** | ||
@@ -1391,29 +1429,1 @@ * Gets the color at a given x/y coordinate | ||
ImageLib.makeSceneImage(0, 0, [], true, Colors.transparent); | ||
export const imageURL = (src) => { | ||
const rawImage = document.createElement("img"); | ||
rawImage.src = src; | ||
return ImageLib.makeFileImage(src, rawImage); | ||
}; | ||
export const videoURL = (src) => { | ||
const rawVideo = document.createElement("video"); | ||
rawVideo.src = src; | ||
return ImageLib.makeFileVideo(src, rawVideo); | ||
}; | ||
export const isAngle = ImageLib.isAngle; | ||
export const isSideCount = ImageLib.isSideCount; | ||
export const isStepCount = ImageLib.isStepCount; | ||
export const isImage = ImageLib.isImage; | ||
export const bitmapURL = imageURL; | ||
export const imagesDifference = ImageLib.imageDifference; | ||
export const imagesEqual = ImageLib.imageEquals; |
@@ -25,5 +25,15 @@ let jsdom = {}; | ||
</html>`; | ||
const dom = new jsdom.JSDOM(html); | ||
document = dom.window.document; | ||
let dom; | ||
if (jsdom.JSDOM === undefined) { | ||
let interval = setInterval(() => { | ||
if (jsdom.JSDOM) { | ||
dom = new jsdom.JSDOM(html); | ||
document = dom.window.document; | ||
clearInterval(interval); | ||
} | ||
}, 100); | ||
} else { | ||
dom = new jsdom.JSDOM(html); | ||
document = dom.window.document; | ||
} | ||
} else { | ||
@@ -30,0 +40,0 @@ document = window.document; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1774143
6810