react-time-input-polyfill
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"files": { | ||
"main.css": "/react-time-input-polyfill/static/css/main.2743c8fd.chunk.css", | ||
"main.js": "/react-time-input-polyfill/static/js/main.1ef2dca7.chunk.js", | ||
"main.js.map": "/react-time-input-polyfill/static/js/main.1ef2dca7.chunk.js.map", | ||
"main.js": "/react-time-input-polyfill/static/js/main.f0da9f91.chunk.js", | ||
"main.js.map": "/react-time-input-polyfill/static/js/main.f0da9f91.chunk.js.map", | ||
"runtime-main.js": "/react-time-input-polyfill/static/js/runtime-main.c87944e3.js", | ||
"runtime-main.js.map": "/react-time-input-polyfill/static/js/runtime-main.c87944e3.js.map", | ||
"static/js/2.c0466f14.chunk.js": "/react-time-input-polyfill/static/js/2.c0466f14.chunk.js", | ||
"static/js/2.c0466f14.chunk.js.map": "/react-time-input-polyfill/static/js/2.c0466f14.chunk.js.map", | ||
"static/js/2.7acf07de.chunk.js": "/react-time-input-polyfill/static/js/2.7acf07de.chunk.js", | ||
"static/js/2.7acf07de.chunk.js.map": "/react-time-input-polyfill/static/js/2.7acf07de.chunk.js.map", | ||
"index.html": "/react-time-input-polyfill/index.html", | ||
"precache-manifest.c568b5f0c1d44acdf2654d08953f762b.js": "/react-time-input-polyfill/precache-manifest.c568b5f0c1d44acdf2654d08953f762b.js", | ||
"precache-manifest.4f3e04b9ba9f8c07accdf6ee7315b4d0.js": "/react-time-input-polyfill/precache-manifest.4f3e04b9ba9f8c07accdf6ee7315b4d0.js", | ||
"service-worker.js": "/react-time-input-polyfill/service-worker.js", | ||
@@ -17,6 +17,6 @@ "static/css/main.2743c8fd.chunk.css.map": "/react-time-input-polyfill/static/css/main.2743c8fd.chunk.css.map" | ||
"static/js/runtime-main.c87944e3.js", | ||
"static/js/2.c0466f14.chunk.js", | ||
"static/js/2.7acf07de.chunk.js", | ||
"static/css/main.2743c8fd.chunk.css", | ||
"static/js/main.1ef2dca7.chunk.js" | ||
"static/js/main.f0da9f91.chunk.js" | ||
] | ||
} |
@@ -17,3 +17,3 @@ /** | ||
importScripts( | ||
"/react-time-input-polyfill/precache-manifest.c568b5f0c1d44acdf2654d08953f762b.js" | ||
"/react-time-input-polyfill/precache-manifest.4f3e04b9ba9f8c07accdf6ee7315b4d0.js" | ||
); | ||
@@ -20,0 +20,0 @@ |
31
index.js
@@ -10,4 +10,2 @@ import React from 'react' | ||
const timeInputs = [] | ||
const leading_zero = number => { | ||
@@ -22,8 +20,8 @@ if (isNaN(number)) return number | ||
let polyfillLoadCalled = false | ||
const loadPolyfill = (callback) => { | ||
if (window.timePolyfillHelpers) { | ||
callback(); | ||
return null; | ||
} | ||
const loadPolyfill = () => { | ||
if (polyfillLoadCalled) return null | ||
polyfillLoadCalled = true | ||
loadJS( | ||
@@ -33,7 +31,3 @@ debugMode | ||
: 'https://cdn.jsdelivr.net/npm/react-time-input-polyfill@1/dist/timePolyfillHelpers.js', | ||
() => { | ||
timeInputs.forEach(input => | ||
input.onPolyfillLoad(window.timePolyfillHelpers), | ||
) | ||
}, | ||
callback | ||
) | ||
@@ -75,7 +69,2 @@ } | ||
} | ||
if (props.forcePolyfill || !supportsTime) { | ||
timeInputs.push(this) | ||
loadPolyfill() | ||
} | ||
} | ||
@@ -124,2 +113,8 @@ | ||
}, 0) | ||
if (this.props.forcePolyfill || !supportsTime) { | ||
loadPolyfill(() => { | ||
this.onPolyfillLoad(window.timePolyfillHelpers) | ||
}) | ||
} | ||
} | ||
@@ -143,3 +138,3 @@ componentWillUnmount() { | ||
this.onTimeChange() | ||
} else if (hasNewPropsValue && !this.state.usePolyfill) { | ||
} else if (hasNewPropsValue) { | ||
this.set_time(this.props.value) | ||
@@ -146,0 +141,0 @@ } |
{ | ||
"name": "react-time-input-polyfill", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A pre-built, plug-and-play, fully accessible React component that will produce an `input[type='time']` element with a built in polyfill for IE and Safari support.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
2030631
4564