Initial commit

master
Sven Slootweg 3 years ago
commit a9145c8a80

1
.gitignore vendored

@ -0,0 +1 @@
node_modules

@ -0,0 +1,33 @@
"use strict";
const pDefer = require("p-defer");
module.exports = function createPauser() {
let isPaused = false;
let promise, resolve;
return {
await: function (passthroughValue) {
if (isPaused) {
return promise.then(() => {
return passthroughValue;
});
} else {
return passthroughValue;
}
},
pause: function () {
isPaused = true;
let defer = pDefer();
promise = defer.promise;
resolve = defer.resolve;
},
unpause: function () {
if (isPaused) {
isPaused = false;
resolve();
}
}
};
};

@ -0,0 +1,11 @@
{
"name": "p-pause",
"version": "0.1.0",
"main": "index.js",
"repository": "https://git.cryto.net/joepie91/p-pause.git",
"author": "Sven Slootweg <admin@cryto.net>",
"license": "WTFPL OR CC0-1.0",
"dependencies": {
"p-defer": "^3.0.0"
}
}

@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
p-defer@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-3.0.0.tgz#d1dceb4ee9b2b604b1d94ffec83760175d4e6f83"
integrity sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw==
Loading…
Cancel
Save