UNPKG

edge-mock

Version:

types for testing an developer edge applications

126 lines 3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EdgeFetchEvent = void 0; class EdgeFetchEvent { type; request; _response = null; _wait_until_promises = []; constructor(type, init) { if (type != 'fetch') { throw new Error('only "fetch" events are supported'); } this.type = type; this.request = init.request; } respondWith(response) { this._response = response; } waitUntil(f) { this._wait_until_promises.push(f); } // all these values/methods are required to be a valid FetchEvent but are not implemented by FetchEvents // in CloudFlare workers, hence returning undefined /* istanbul ignore next */ get clientId() { return undefined; } /* istanbul ignore next */ get resultingClientId() { return undefined; } /* istanbul ignore next */ get bubbles() { return undefined; } /* istanbul ignore next */ get cancelBubble() { return undefined; } /* istanbul ignore next */ get cancelable() { return undefined; } /* istanbul ignore next */ get composed() { return undefined; } /* istanbul ignore next */ get currentTarget() { return undefined; } /* istanbul ignore next */ get defaultPrevented() { return undefined; } /* istanbul ignore next */ get isTrusted() { return undefined; } /* istanbul ignore next */ get returnValue() { return undefined; } /* istanbul ignore next */ get srcElement() { return undefined; } /* istanbul ignore next */ get target() { return undefined; } /* istanbul ignore next */ get timeStamp() { return undefined; } /* istanbul ignore next */ get eventPhase() { return undefined; } /* istanbul ignore next */ get AT_TARGET() { return undefined; } /* istanbul ignore next */ get BUBBLING_PHASE() { return undefined; } /* istanbul ignore next */ get CAPTURING_PHASE() { return undefined; } /* istanbul ignore next */ get NONE() { return undefined; } /* istanbul ignore next */ get preloadResponse() { return undefined; } /* istanbul ignore next */ get initEvent() { return undefined; } /* istanbul ignore next */ get passThroughOnException() { return undefined; } /* istanbul ignore next */ get composedPath() { return undefined; } /* istanbul ignore next */ get preventDefault() { return undefined; } /* istanbul ignore next */ get stopImmediatePropagation() { return undefined; } /* istanbul ignore next */ get stopPropagation() { return undefined; } } exports.EdgeFetchEvent = EdgeFetchEvent; //# sourceMappingURL=FetchEvent.js.map