You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use Sharing Functionalities from README as an example to configure my tasks but it seems to not working, because this in function arguments of series and parallel stay bound to the Global object.
There is a gulpfile.js to reproduce:
varutil=require('util');vargulp=require('gulp');varDefaultRegistry=require('undertaker-registry');functionConfigRegistry(config){DefaultRegistry.call(this);this.config=config;}util.inherits(ConfigRegistry,DefaultRegistry);ConfigRegistry.prototype.set=functionset(name,fn){// The `DefaultRegistry` uses `this._tasks` for storage.vartask=this._tasks[name]=fn.bind(this.config);returntask;};// `taker.registry` will reset each task in the registry with// `ConfigRegistry.prototype.set` which will bind them to the config object.gulp.registry(newConfigRegistry({config: {src: './src',build: './build',bindTo: '0.0.0.0:8888'}}));gulp.task('dummy',function(cb){// OKconsole.log('Config: '+JSON.stringify(this.config));cb();})gulp.task('test-series',gulp.series('dummy',function(cb){// undefinedconsole.log('Config: '+JSON.stringify(this.config));cb();}));gulp.task('test-parallel',gulp.parallel('dummy',function(cb){// undefinedconsole.log('Config: '+JSON.stringify(this.config));cb();}))
The text was updated successfully, but these errors were encountered:
When passing a function into a series or parallel call, it avoids the task system. This is something I've been thinking about a lot and don't have a solution for currently (for example, every anonymous function would be registered as "anonymous" in the task system, breaking all sorts of things).
I tried to use
Sharing Functionalities
fromREADME
as an example to configure my tasks but it seems to not working, becausethis
in function arguments ofseries
andparallel
stay bound to theGlobal object
.There is a
gulpfile.js
to reproduce:The text was updated successfully, but these errors were encountered: