From 2a0e473e347959cf7dd58c48ec3193a64d63bb08 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Mon, 6 Jul 2015 14:39:25 +0200 Subject: [PATCH] Add definitions for gulp-watch (https://github.com/floatdrop/gulp-watch) --- gulp-watch/gulp-watch-tests.ts | 19 +++++++++++++++++++ gulp-watch/gulp-watch.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 gulp-watch/gulp-watch-tests.ts create mode 100644 gulp-watch/gulp-watch.d.ts diff --git a/gulp-watch/gulp-watch-tests.ts b/gulp-watch/gulp-watch-tests.ts new file mode 100644 index 000000000..5e158a045 --- /dev/null +++ b/gulp-watch/gulp-watch-tests.ts @@ -0,0 +1,19 @@ +/// +/// + +import gulp = require('gulp'); +import watch = require('gulp-watch'); + +gulp.task('stream', () => + gulp.src('css/**/*.css') + .pipe(watch('css/**/*.css')) + .pipe(gulp.dest('build')) +); + +gulp.task('callback', (cb) => + watch('css/**/*.css', () => + gulp.src('css/**/*.css') + .pipe(watch('css/**/*.css')) + .on('end', cb) + ) +); diff --git a/gulp-watch/gulp-watch.d.ts b/gulp-watch/gulp-watch.d.ts new file mode 100644 index 000000000..b3a16bbdd --- /dev/null +++ b/gulp-watch/gulp-watch.d.ts @@ -0,0 +1,27 @@ +// Type definitions for gulp-watch v4.1.1 +// Project: https://github.com/floatdrop/gulp-watch +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'gulp-watch' { + interface IOptions { + ignoreInitial?: boolean; + events?: Array; + base?: string; + name?: string; + verbose?: boolean; + readDelay?: number; + } + + interface IWatchStream extends NodeJS.ReadWriteStream { + add(path: string | Array): NodeJS.ReadWriteStream; + unwatch(path: string | Array): NodeJS.ReadWriteStream; + close(): NodeJS.ReadWriteStream; + } + + function watch(glob: string, options?: IOptions, callback?: Function): IWatchStream; + + export = watch; +}