Files
DefinitelyTyped/tapable/tapable-tests.ts
Scott(JuJiang) 8b066c8528 feat: add definition for tapable of webpack (#12376)
* feat: add definition for tapable of webpack

* fix: enable strictNullChecks and adjust tests
2016-11-02 23:43:39 +09:00

44 lines
1.3 KiB
TypeScript

/// <reference path="index.d.ts" />
import Tapable = require('tapable');
class DllPlugin {
apply(compiler: Compiler) {
compiler.plugin('doSomething', function (...args: string[]) {
console.log(args);
});
compiler.plugin(['doSomething', 'doNothing'], function (...args: string[]) {
console.log(args);
});
}
}
class Compiler extends Tapable {
constructor(){
super()
}
}
const compiler = new Compiler();
let callback: Tapable.CallbackFunction = function () {
};
compiler.apply(new DllPlugin());
compiler.applyPlugins('doSomething', 'a', 'b');
compiler.applyPluginsWaterfall('doSomething', 'a', 'b');
compiler.applyPluginsWaterfall0('doSomething', 'a');
compiler.applyPluginsBailResult('doSomething', 'a', 'b');
compiler.applyPluginsBailResult1('doSomething', ['a', 'b']);
compiler.applyPluginsAsync('doSomething', 'a', 'b');
compiler.applyPluginsAsyncSeries('doSomething', 'a', 'b');
compiler.applyPluginsAsyncSeriesBailResult('doSomething', 'a', 'b');
compiler.applyPluginsAsyncSeriesBailResult1('doSomething', 'a', callback);
compiler.applyPluginsAsyncWaterfall('doSomething', 'a', callback);
compiler.applyPluginsParallel('doSomething', 'a', 'b');
compiler.applyPluginsParallelBailResult('doSomething', 'a', 'b');
compiler.applyPluginsParallelBailResult1('doSomething', 'a', callback);