How to use the deferred.delay function in deferred

To help you get started, we’ve selected a few deferred examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github medikoo / fs2 / test / readdir.js View on Github external
/* eslint max-lines: off */

"use strict";

var push       = Array.prototype.push
  , fs         = require("fs")
  , pathUtils  = require("path")
  , aFrom      = require("es5-ext/array/from")
  , diff       = require("es5-ext/array/#/diff")
  , startsWith = require("es5-ext/string/#/starts-with")
  , deferred   = require("deferred")
  , delay      = deferred.delay
  , promisify  = deferred.promisify
  , mkdir      = promisify(fs.mkdir)
  , writeFile  = promisify(fs.writeFile)
  , unlink     = promisify(fs.unlink)
  , rmdir      = promisify(fs.rmdir)
  , basename   = pathUtils.basename
  , resolve    = pathUtils.resolve
  , sep        = pathUtils.sep
  , pgPath     = resolve(__dirname, "./__playground/readdir");

module.exports = function (t) {
	var pathsAll, paths2, paths0, files2, replaceSep, DELAY = 100;
	replaceSep = function (path) { return path.replace(/\//g, sep); };
	pathsAll = [
		"done", "done/done", "done/done/dthree", "done/done/dthree/dthree",
		"done/done/dthree/dthree/foo", "done/done/dthree/dtwo", "done/done/dthree/dtwo/foo",
github medikoo / fs2 / test / lib / find-root.js View on Github external
"use strict";

var fs        = require("fs")
  , deferred  = require("deferred")
  , resolve   = require("path").resolve
  , promisify = deferred.promisify
  , delay     = deferred.delay
  , mkdir     = promisify(fs.mkdir)
  , rmdir     = promisify(fs.rmdir)
  , gitMode   = require("../../lib/ignore-modes/git")
  , rootPath  = resolve(__dirname, "../__playground/lib/find-root");

module.exports = function (t, a, d) {
	var gitRoot = resolve(rootPath, ".git")
	  , onePath = resolve(rootPath, "one")
	  , gitOnePath = resolve(onePath, ".git")
	  , twoPath = resolve(onePath, "two")
	  , gitTwoPath = resolve(twoPath, ".git")
	  , filePath = resolve(twoPath, "file.xxx");

	var DELAY = 100, watcher, events = [];

	// Create /.git
github medikoo / fs2 / test / read-file.js View on Github external
"use strict";

var deferred   = require("deferred")
  , bufferFrom = require("../lib/buffer-from")
  , delay      = deferred.delay
  , promisify  = deferred.promisify
  , isBuffer   = Buffer.isBuffer
  , fs         = require("fs")
  , resolve    = require("path").resolve
  , open       = promisify(fs.open)
  , write      = promisify(fs.write)
  , close      = promisify(fs.close)
  , writeFile  = promisify(fs.writeFile)
  , unlink     = promisify(fs.unlink)
  , pgPath     = resolve(__dirname, "./__playground/read-file");

module.exports = function (t) {
	var DELAY = 100;

	return {
		Regular: {
github medikoo / fs2 / test / watch.js View on Github external
"use strict";

var fs         = require("fs")
  , resolve    = require("path").resolve
  , deferred   = require("deferred")
  , bufferFrom = require("../lib/buffer-from")
  , delay      = deferred.delay
  , promisify  = deferred.promisify
  , mkdir      = promisify(fs.mkdir)
  , open       = promisify(fs.open)
  , rename     = promisify(fs.rename)
  , write      = promisify(fs.write)
  , close      = promisify(fs.close)
  , writeFile  = promisify(fs.writeFile)
  , unlink     = promisify(fs.unlink)
  , rmdir      = promisify(fs.rmdir)
  , pgPath     = resolve(__dirname, "./__playground/watch");

module.exports = function (t, a, d) {
	var ondirchange = 0
	  , onfilechange = 0
	  , ondirend = 0
	  , onfileend = 0
github medikoo / fs2 / test / lib / watch-alt.js View on Github external
"use strict";

var fs         = require("fs")
  , resolve    = require("path").resolve
  , deferred   = require("deferred")
  , bufferFrom = require("../../lib/buffer-from")
  , delay      = deferred.delay
  , promisify  = deferred.promisify
  , mkdir      = promisify(fs.mkdir)
  , open       = promisify(fs.open)
  , rename     = promisify(fs.rename)
  , write      = promisify(fs.write)
  , close      = promisify(fs.close)
  , writeFile  = promisify(fs.writeFile)
  , unlink     = promisify(fs.unlink)
  , rmdir      = promisify(fs.rmdir)
  , pgPath     = resolve(__dirname, "../__playground/lib/watch-alt");

module.exports = function (t, a, d) {
	var ondirchange = 0
	  , onfilechange = 0
	  , ondirend = 0
	  , onfileend = 0
github medikoo / fs2 / test / lib / watch.js View on Github external
"use strict";

var fs         = require("fs")
  , resolve    = require("path").resolve
  , deferred   = require("deferred")
  , bufferFrom = require("../../lib/buffer-from")
  , delay      = deferred.delay
  , promisify  = deferred.promisify
  , mkdir      = promisify(fs.mkdir)
  , open       = promisify(fs.open)
  , rename     = promisify(fs.rename)
  , write      = promisify(fs.write)
  , close      = promisify(fs.close)
  , writeFile  = promisify(fs.writeFile)
  , unlink     = promisify(fs.unlink)
  , rmdir      = promisify(fs.rmdir)
  , pgPath     = resolve(__dirname, "../__playground/lib/watch");

module.exports = function (t, a, d) {
	var ondirchange = 0
	  , onfilechange = 0
	  , ondirend = 0
	  , onfileend = 0
github medikoo / fs2 / test / watch-path.js View on Github external
"use strict";

var fs         = require("fs")
  , resolve    = require("path").resolve
  , deferred   = require("deferred")
  , bufferFrom = require("../lib/buffer-from")
  , delay      = deferred.delay
  , promisify  = deferred.promisify
  , mkdir      = promisify(fs.mkdir)
  , open       = promisify(fs.open)
  , rename     = promisify(fs.rename)
  , write      = promisify(fs.write)
  , close      = promisify(fs.close)
  , writeFile  = promisify(fs.writeFile)
  , unlink     = promisify(fs.unlink)
  , rmdir      = promisify(fs.rmdir)
  , pgPath     = resolve(__dirname, "./__playground/watch-path");

module.exports = function (t, a, d) {
	var ondirchange = []
	  , onfilechange = []
	  , DELAY = 100
	  , dirPath = resolve(pgPath, "tmpdir")
github medikoo / fs2 / test / lib / get-conf-file-map.js View on Github external
"use strict";

var fs        = require("fs")
  , resolve   = require("path").resolve
  , omap      = require("es5-ext/object/map")
  , deferred  = require("deferred")
  , delay     = deferred.delay
  , promisify = deferred.promisify
  , mkdir     = promisify(fs.mkdir)
  , writeFile = promisify(fs.writeFile)
  , unlink    = promisify(fs.unlink)
  , rmdir     = promisify(fs.rmdir)
  , mode      = require("../../lib/ignore-modes/git")
  , pgPath    = resolve(__dirname, "../__playground/lib/get-conf-file-map");

module.exports = function (t, a, d) {
	var data
	  , invoked = false
	  , DELAY = 100
	  , gitRoot = resolve(pgPath, ".git")
	  , rootFile = resolve(pgPath, ".gitignore")
	  , onePath = resolve(pgPath, "one")
	  , oneFile = resolve(onePath, ".gitignore")
github medikoo / fs2 / test / is-ignored.js View on Github external
"use strict";

var fs        = require("fs")
  , resolve   = require("path").resolve
  , noop      = require("es5-ext/function/noop")
  , deferred  = require("deferred")
  , delay     = deferred.delay
  , promisify = deferred.promisify
  , mkdir     = promisify(fs.mkdir)
  , writeFile = promisify(fs.writeFile)
  , unlink    = promisify(fs.unlink)
  , rmdir     = promisify(fs.rmdir)
  , modes     = require("../lib/ignore-modes")
  , pgPath    = resolve(__dirname, "./__playground/is-ignored");

module.exports = function (t, a, d) {
	var invoked = null
	  , testIsRoot
	  , DELAY = 100
	  , gitRoot = resolve(pgPath, ".git")
	  , rootFile = resolve(pgPath, ".gitignore")
	  , onePath = resolve(pgPath, "one")
	  , oneFile = resolve(onePath, ".gitignore")
github medikoo / fs2 / test / lib / ignore-modes / git.js View on Github external
"use strict";

var isValue   = require("es5-ext/object/is-value")
  , fs        = require("fs")
  , deferred  = require("deferred")
  , resolve   = require("path").resolve
  , promisify = deferred.promisify
  , delay     = deferred.delay
  , mkdir     = promisify(fs.mkdir)
  , rmdir     = promisify(fs.rmdir)
  , isArray   = Array.isArray
  , rootPath  = resolve(__dirname, "../../__playground/lib/ignore-modes/git");

module.exports = function (t, a, d) {
	var gitRoot = resolve(rootPath, ".git")
	  , onePath = resolve(rootPath, "one")
	  , gitOnePath = resolve(onePath, ".git")
	  , twoPath = resolve(onePath, "two")
	  , gitTwoPath = resolve(twoPath, ".git")
	  , rootEvents = []
	  , oneEvents = []
	  , twoEvents = []
	  , w1
	  , w2

deferred

Modular and fast Promises implementation

ISC
Latest version published 5 years ago

Package Health Score

65 / 100
Full package analysis