Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jasonsbarr/htdp-image

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jasonsbarr/htdp-image - npm Package Compare versions

Comparing version 0.6.1 to 0.6.3

2

package.json

@@ -8,3 +8,3 @@ {

},
"version": "0.6.1",
"version": "0.6.3",
"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.6.1/dist/index.umd.js"></script>
<script src="https://www.unpkg.com/@jasonsbarr/htdp-image@0.6.3/dist/index.umd.js"></script>

@@ -48,0 +48,0 @@ <script>

@@ -23,2 +23,3 @@ import { makeDocument } from "../../shared/document.js";

this.src = src;
this._isLoaded = false;

@@ -34,2 +35,3 @@ if (rawVideo) {

this.video.loop = true;
this._isLoaded = true;
this.video.play();

@@ -47,2 +49,3 @@ } else {

this.video.loop = true;
this._isLoaded = true;
this.video.play();

@@ -72,2 +75,6 @@ });

get isLoaded() {
return this._isLoaded;
}
/**

@@ -74,0 +81,0 @@ * Checks for equality

@@ -125,2 +125,11 @@ import * as Lib from "./image-lib/index.js";

const imageIsLoaded = (img) => img.isLoaded;
const renderImage = (image, element) => {
const canvas = Lib.makeCanvas(image.width, image.height);
const context = canvas.getContext("2d");
element.appendChild(canvas);
image.render(context);
};
/**

@@ -132,7 +141,17 @@ * Renders an image to the DOM

export const render = (image, element = document.body) => {
const canvas = Lib.makeCanvas(image.width, image.height);
const context = canvas.getContext("2d");
if (image instanceof FileImage || image instanceof FileVideo) {
if (imageIsLoaded(image)) {
renderImage(image, element);
return;
}
element.appendChild(canvas);
image.render(context);
let interval = setInterval(() => {
if (imageIsLoaded(image)) {
renderImage(image, element);
clearInterval(interval);
}
}, 100);
} else {
renderImage(image, element);
}
};

@@ -139,0 +158,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc