Socket
Socket
Sign inDemoInstall

react-window-decorators

Package Overview
Dependencies
10
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

10

CHANGELOG.md
# Changelog
### v1.0.4
14.12.2018.
**Changed**
* Changed how custom event is dispatched.
-----
### v1.0.3

@@ -4,0 +14,0 @@

44

lib/window-manager.js

@@ -29,22 +29,9 @@ 'use strict';

var isWindowDefined = typeof window === 'undefined';
// ------------------------------------------------
// CustomEvent polyfill
// Custom Event detection
// ------------------------------------------------
if (typeof window !== 'undefined' && typeof window.CustomEvent !== 'function') {
var CustomEventPollyfill = function CustomEventPollyfill(event, userParams) {
var params = {
bubbles: userParams.bubbles || false,
cancelable: userParams.cancelable || false,
detail: userParams.detail || undefined
};
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};
var supportsCustomEvents = isWindowDefined && typeof window.CustomEvent === 'function';
CustomEventPollyfill.prototype = window.Event.prototype;
window.CustomEvent = CustomEventPollyfill;
}
// ------------------------------------------------

@@ -60,3 +47,3 @@ // Window Manager

if (typeof window === 'undefined') {
if (isWindowDefined) {
// Silently return null if it is used on server

@@ -140,10 +127,17 @@ return null;

this.timeoutID = setTimeout(function () {
var event = new CustomEvent(EVENT_NAME, {
detail: {
breakpoint: _this.getBreakpoint(),
dimensions: _this.getDimensions(),
orientation: _this.getOrientation()
}
});
var event = void 0;
var detail = {
breakpoint: _this.getBreakpoint(),
dimensions: _this.getDimensions(),
orientation: _this.getOrientation()
};
if (supportsCustomEvents) {
event = new CustomEvent(EVENT_NAME, detail);
} else {
event = document.createEvent('CustomEvent');
event.initCustomEvent(EVENT_NAME, false, false, detail);
}
// Dispatch the event.

@@ -150,0 +144,0 @@ window.dispatchEvent(event);

{
"name": "react-window-decorators",
"version": "1.0.3",
"version": "1.0.4",
"private": false,

@@ -49,3 +49,3 @@ "license": "MIT",

"prop-types": "^15.5.8",
"window-scroll-manager": "^1.1.3"
"window-scroll-manager": "^1.1.4"
},

@@ -52,0 +52,0 @@ "peerDependencies": {

@@ -15,22 +15,9 @@ import isTouchDevice from 'is-touch-device';

const isWindowDefined = typeof window === 'undefined';
// ------------------------------------------------
// CustomEvent polyfill
// Custom Event detection
// ------------------------------------------------
if (typeof window !== 'undefined' && typeof window.CustomEvent !== 'function') {
const CustomEventPollyfill = function (event, userParams) {
const params = {
bubbles: userParams.bubbles || false,
cancelable: userParams.cancelable || false,
detail: userParams.detail || undefined,
};
const evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};
const supportsCustomEvents = isWindowDefined && typeof window.CustomEvent === 'function';
CustomEventPollyfill.prototype = window.Event.prototype;
window.CustomEvent = CustomEventPollyfill;
}
// ------------------------------------------------

@@ -41,3 +28,3 @@ // Window Manager

constructor(breakpoints, debounceTime = 250) {
if (typeof window === 'undefined') {
if (isWindowDefined) {
// Silently return null if it is used on server

@@ -114,10 +101,17 @@ return null;

this.timeoutID = setTimeout(() => {
const event = new CustomEvent(EVENT_NAME, {
detail: {
breakpoint: this.getBreakpoint(),
dimensions: this.getDimensions(),
orientation: this.getOrientation(),
},
});
let event;
const detail = {
breakpoint: this.getBreakpoint(),
dimensions: this.getDimensions(),
orientation: this.getOrientation(),
};
if (supportsCustomEvents) {
event = new CustomEvent(EVENT_NAME, detail);
} else {
event = document.createEvent('CustomEvent');
event.initCustomEvent(EVENT_NAME, false, false, detail);
}
// Dispatch the event.

@@ -124,0 +118,0 @@ window.dispatchEvent(event);

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc