source: trip-planner-front/node_modules/tapable/lib/SyncLoopHook.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[6a3a178]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5"use strict";
6
7const Hook = require("./Hook");
8const HookCodeFactory = require("./HookCodeFactory");
9
10class 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
20const factory = new SyncLoopHookCodeFactory();
21
22const TAP_ASYNC = () => {
23 throw new Error("tapAsync is not supported on a SyncLoopHook");
24};
25
26const TAP_PROMISE = () => {
27 throw new Error("tapPromise is not supported on a SyncLoopHook");
28};
29
30const COMPILE = function(options) {
31 factory.setup(this, options);
32 return factory.create(options);
33};
34
35function SyncLoopHook(args = [], name = undefined) {
36 const hook = new Hook(args, name);
37 hook.constructor = SyncLoopHook;
38 hook.tapAsync = TAP_ASYNC;
39 hook.tapPromise = TAP_PROMISE;
40 hook.compile = COMPILE;
41 return hook;
42}
43
44SyncLoopHook.prototype = null;
45
46module.exports = SyncLoopHook;
Note: See TracBrowser for help on using the repository browser.