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

fancy-canvas

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fancy-canvas - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

6

coordinate-space.d.ts

@@ -5,4 +5,6 @@ export declare type Size = {

};
export declare type CanvasConfiguredListener = (this: Binding) => void;
export interface Binding {
destroy(): void;
readonly canvas: HTMLCanvasElement;
/**

@@ -12,4 +14,6 @@ * Canvas element size in CSS pixels

canvasSize: Size;
pixelRatio: number;
readonly pixelRatio: number;
subscribeCanvasConfigured(listener: CanvasConfiguredListener): void;
unsubscribeCanvasConfigured(listener: CanvasConfiguredListener): void;
}
export declare function bindToDevicePixelRatio(canvas: HTMLCanvasElement): Binding;

@@ -9,2 +9,3 @@ export function bindToDevicePixelRatio(canvas) {

this._resolutionListener = function (ev) { return _this._onResolutionChanged(); };
this._canvasConfiguredListeners = [];
this._canvas = canvas;

@@ -19,2 +20,3 @@ this._canvasSize = {

DevicePixelRatioBinding.prototype.destroy = function () {
this._canvasConfiguredListeners.length = 0;
this._uninstallResolutionListener();

@@ -24,2 +26,9 @@ this._canvasSize = null;

};
Object.defineProperty(DevicePixelRatioBinding.prototype, "canvas", {
get: function () {
return this._canvas;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DevicePixelRatioBinding.prototype, "canvasSize", {

@@ -50,2 +59,8 @@ get: function () {

});
DevicePixelRatioBinding.prototype.subscribeCanvasConfigured = function (listener) {
this._canvasConfiguredListeners.push(listener);
};
DevicePixelRatioBinding.prototype.unsubscribeCanvasConfigured = function (listener) {
this._canvasConfiguredListeners = this._canvasConfiguredListeners.filter(function (l) { return l != listener; });
};
DevicePixelRatioBinding.prototype._configureCanvas = function () {

@@ -57,3 +72,8 @@ var ratio = this.pixelRatio;

this._canvas.height = this._canvasSize.height * ratio;
this._emitCanvasConfigured();
};
DevicePixelRatioBinding.prototype._emitCanvasConfigured = function () {
var _this = this;
this._canvasConfiguredListeners.forEach(function (listener) { return listener.call(_this); });
};
DevicePixelRatioBinding.prototype._installResolutionListener = function () {

@@ -60,0 +80,0 @@ if (this._resolutionMediaQueryList !== null) {

2

package.json
{
"name": "fancy-canvas",
"version": "0.1.1",
"version": "0.1.2",
"author": "smakarov@tradingview.com",

@@ -5,0 +5,0 @@ "description": "Functionality on top of HTML canvas element, including support for HiDPI and pixel-perfect rendering",

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