source: trip-planner-front/node_modules/tapable/lib/SyncHook.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
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 SyncHookCodeFactory extends HookCodeFactory {
11 content({ onError, onDone, rethrowIfPossible }) {
12 return this.callTapsSeries({
13 onError: (i, err) => onError(err),
14 onDone,
15 rethrowIfPossible
16 });
17 }
18}
19
20const factory = new SyncHookCodeFactory();
21
22const TAP_ASYNC = () => {
23 throw new Error("tapAsync is not supported on a SyncHook");
24};
25
26const TAP_PROMISE = () => {
27 throw new Error("tapPromise is not supported on a SyncHook");
28};
29
30const COMPILE = function(options) {
31 factory.setup(this, options);
32 return factory.create(options);
33};
34
35function SyncHook(args = [], name = undefined) {
36 const hook = new Hook(args, name);
37 hook.constructor = SyncHook;
38 hook.tapAsync = TAP_ASYNC;
39 hook.tapPromise = TAP_PROMISE;
40 hook.compile = COMPILE;
41 return hook;
42}
43
44SyncHook.prototype = null;
45
46module.exports = SyncHook;
Note: See TracBrowser for help on using the repository browser.