1
|
/*
|
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
Author Tobias Koppers @sokra
|
4
|
*/
|
5
|
"use strict";
|
6
|
|
7
|
const Hook = require("./Hook");
|
8
|
const HookCodeFactory = require("./HookCodeFactory");
|
9
|
|
10
|
class SyncLoopHookCodeFactory extends HookCodeFactory {
|
11
|
content({ onError, onDone, rethrowIfPossible }) {
|
12
|
return this.callTapsLooping({
|
13
|
onError: (i, err) => onError(err),
|
14
|
onDone,
|
15
|
rethrowIfPossible
|
16
|
});
|
17
|
}
|
18
|
}
|
19
|
|
20
|
const factory = new SyncLoopHookCodeFactory();
|
21
|
|
22
|
class SyncLoopHook extends Hook {
|
23
|
tapAsync() {
|
24
|
throw new Error("tapAsync is not supported on a SyncLoopHook");
|
25
|
}
|
26
|
|
27
|
tapPromise() {
|
28
|
throw new Error("tapPromise is not supported on a SyncLoopHook");
|
29
|
}
|
30
|
|
31
|
compile(options) {
|
32
|
factory.setup(this, options);
|
33
|
return factory.create(options);
|
34
|
}
|
35
|
}
|
36
|
|
37
|
module.exports = SyncLoopHook;
|