diff --git a/src/components/super-spawner.js b/src/components/super-spawner.js index 67e3b63fc4cc0eaf036111d6078155699f4adec7..b33d4a3c52078ff1453e59f19b7ef36d0435224e 100644 --- a/src/components/super-spawner.js +++ b/src/components/super-spawner.js @@ -1,10 +1,5 @@ import { addMedia } from "../utils/media-utils"; - -const waitForEvent = function(eventName, eventObj) { - return new Promise(resolve => { - eventObj.addEventListener(eventName, resolve, { once: true }); - }); -}; +import { waitForEvent } from "../utils/async-utils"; let nextGrabId = 0; /** diff --git a/src/utils/async-utils.js b/src/utils/async-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..99954f683ccbf14cb7360524a7b44b48db734c30 --- /dev/null +++ b/src/utils/async-utils.js @@ -0,0 +1,5 @@ +export const waitForEvent = function(eventName, eventObj) { + return new Promise(resolve => { + eventObj.addEventListener(eventName, resolve, { once: true }); + }); +};