react-cross-client-router
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -29,4 +29,10 @@ import React, { Component } from 'react'; | ||
/** | ||
* if we are on react-native, there is no window.addEventListener | ||
* @link https://github.com/pubkey/unload/issues/6 | ||
*/ | ||
if (typeof window.addEventListener !== 'function') return; | ||
/** | ||
* for normal browser-windows, we use the beforeunload-event | ||
*/ | ||
window.addEventListener('beforeunload', function () { | ||
@@ -104,3 +110,3 @@ fn(); | ||
startListening(); | ||
if (typeof fn !== 'function') throw new Error('The "listener" argument must be of type Function. Received type ' + typeof fn); | ||
if (typeof fn !== 'function') throw new Error('Listener is no function'); | ||
LISTENERS.add(fn); | ||
@@ -107,0 +113,0 @@ var addReturn = { |
@@ -36,4 +36,10 @@ 'use strict'; | ||
/** | ||
* if we are on react-native, there is no window.addEventListener | ||
* @link https://github.com/pubkey/unload/issues/6 | ||
*/ | ||
if (typeof window.addEventListener !== 'function') return; | ||
/** | ||
* for normal browser-windows, we use the beforeunload-event | ||
*/ | ||
window.addEventListener('beforeunload', function () { | ||
@@ -111,3 +117,3 @@ fn(); | ||
startListening(); | ||
if (typeof fn !== 'function') throw new Error('The "listener" argument must be of type Function. Received type ' + typeof fn); | ||
if (typeof fn !== 'function') throw new Error('Listener is no function'); | ||
LISTENERS.add(fn); | ||
@@ -114,0 +120,0 @@ var addReturn = { |
{ | ||
"name": "react-cross-client-router", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A tool to control React apps spanning multiple tabs, windows or devices", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
76295
1021