Skip to content

Commit

Permalink
fix: do not use window outside main function (#95)
Browse files Browse the repository at this point in the history
This adds support for SSR.

Closes #94.
  • Loading branch information
meteorlxy authored and francoischalifour committed Mar 21, 2019
1 parent e1b85df commit 541e8f0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/medium-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ const createCustomEvent = (type, params) => {
return customEvent
}

/**
* Ensure the compatibility with IE11 if no Promise polyfill are used.
*/
const Promise =
window.Promise ||
function Promise(fn) {
function noop() {}
fn(noop, noop)
}

const mediumZoom = (selector, options = {}) => {
/**
* Ensure the compatibility with IE11 if no Promise polyfill are used.
*/
const Promise =
window.Promise ||
function Promise(fn) {
function noop() {}
fn(noop, noop)
}

const _handleClick = event => {
const { target } = event

Expand Down

0 comments on commit 541e8f0

Please sign in to comment.