8000 Breaking: Remove array & string task support from gulp.watch · gulpjs/gulp@b085e95 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit b085e95

Browse files
dinoboffphated
authored andcommitted
Breaking: Remove array & string task support from gulp.watch
1 parent ad627e6 commit b085e95

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

docs/API.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,17 @@ Type: `Array`, `String` or `Function`
487487
A task name, a function or an array of either.
488488

489489

490-
### gulp.watch(glob[, opts], tasks)
490+
### gulp.watch(glob[, opts], fn)
491491

492492
Watch files and do something when a file changes.
493493

494494
```js
495495
gulp.watch('js/**/*.js', gulp.parallel('uglify', 'reload'));
496496
```
497497

498+
In the example, `gulp.watch` runs the function returned by gulp.parallel each
499+
time a file with the `js` extension in `js/` is updated.
500+
498501
#### glob
499502
Type: `String` or `Array`
500503

@@ -505,17 +508,10 @@ Type: `Object`
505508

506509
Options, that are passed to [`gaze`][gaze].
507510

508-
#### tasks
509-
Type: `Array`, `Function` or `String`
510-
511-
A task name, a function or an array of either to run when a file changes.
511+
#### fn
512+
Type: `Function`
512513

513-
When `tasks` is an array, the tasks will be run in parallel:
514-
```
515-
gulp.watch('*.js', [one, two]);
516-
// is equivalent to
517-
gulp.watch('*.js', gulp.parallel(one, two));
518-
```
514+
An [async](#async-support) function to run when a file changes.
519515

520516
`gulp.watch` returns an `EventEmitter` object which emits `change` events with
521517
the [gaze] `event`:

index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ util.inherits(Gulp, Undertaker);
1212
Gulp.prototype.src = vfs.src;
1313
Gulp.prototype.dest = vfs.dest;
1414
Gulp.prototype.watch = function(glob, opt, task) {
15-
var isFunction = (typeof opt === 'function');
16-
var isString = (typeof opt === 'string');
17-
var isArray = Array.isArray(opt);
18-
if (isFunction || isString || isArray) {
15+
if (typeof opt === 'function') {
1916
task = opt;
2017
opt = null;
2118
}

0 commit comments

Comments
 (0)
0