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.228 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.227 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.226 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.225 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.224 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.9 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.223 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.222 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.221 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.220 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.219 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.218 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.217 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.216 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.215 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.214 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.213 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.212 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.211 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js
smock-0.1.210 node_modules/webpack/node_modules/watchpack/playground/watch-folder.js