Sha256: 874b9e3315b496d9475b71a11df7a0e543d093342ce0dd44dff7838b7426bc8d

Contents?: true

Size: 959 Bytes

Versions: 62

Compression:

Stored size: 959 Bytes

Contents

var path = require("path");
var Watchpack = require("../");

var folder = path.join(__dirname, "folder");

function startWatcher(name, files, folders) {
	var w = new Watchpack({
		aggregateTimeout: 3000
	});

	w.on("change", function(file, mtime) {
		console.log(name, "change", path.relative(folder, file), mtime);
	});

	w.on("aggregated", function(changes) {
		var times = w.getTimes();
		console.log(name, "aggregated", changes.map(function(file) {
			return path.relative(folder, file);
		}), Object.keys(times).reduce(function(obj, file) {
			obj[path.relative(folder, file)] = times[file];
			return obj
		}, {}));
	});

	var startTime = Date.now() - 10000;
	console.log(name, startTime);
	w.watch(files, folders, startTime);
}

startWatcher("folder", [], [folder]);
startWatcher("sub+files", [
	path.join(folder, "a.txt"),
	path.join(folder, "b.txt"),
	path.join(folder, "c.txt"),
	path.join(folder, "d.txt"),
], [
	path.join(folder, "subfolder")
]);

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
smock-0.1.268 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.267 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.266 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.265 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.264 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.263 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.262 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.261 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.260 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.259 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.258 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.256 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.255 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.254 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.253 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.252 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.251 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.250 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.249 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.247 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js