document-promises-pinkie
Advanced tools
Comparing version 3.1.2 to 3.1.3
import Promise from "pinkie-promise"; | ||
// thenfied document ready states | ||
const thenify = (type, readyState) => | ||
new Promise(resolve => { | ||
const listener = () => { | ||
function thenify(type, readyState) { | ||
return new Promise(function(resolve) { | ||
const listener = function() { | ||
if (readyState.test(document.readyState)) { | ||
@@ -12,3 +12,3 @@ document.removeEventListener(type, listener); | ||
} | ||
}; | ||
} | ||
@@ -19,6 +19,7 @@ document.addEventListener(type, listener); | ||
}); | ||
} | ||
// export thenfied parsed, contentLoaded, and loaded | ||
export const parsed = thenify("readystatechange", /^(?:interactive|complete)$/); | ||
export const contentLoaded = thenify("DOMContentLoaded", /^(?:interactive|complete)$/); | ||
export const loaded = thenify("readystatechange", /^complete$/); | ||
export var parsed = thenify("readystatechange", /^(?:interactive|complete)$/); | ||
export var contentLoaded = thenify("DOMContentLoaded", /^(?:interactive|complete)$/); | ||
export var loaded = thenify("readystatechange", /^complete$/); |
{ | ||
"name": "document-promises-pinkie", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "Document loading states as Promises", | ||
@@ -5,0 +5,0 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com> (http://jonathantneal.com)", |
15284
33