MCPcopy Index your code
hub / github.com/SocketCluster/socketcluster-server / AGAction

Function AGAction

action.js:4–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2const InvalidActionError = scErrors.InvalidActionError;
3
4function AGAction() {
5 this.outcome = null;
6 this.promise = new Promise((resolve, reject) => {
7 this._resolve = resolve;
8 this._reject = reject;
9 });
10
11 this.allow = (packet) => {
12 if (this.outcome) {
13 throw new InvalidActionError(`AGAction ${this.type} has already been ${this.outcome}; cannot allow`);
14 }
15 this.outcome = 'allowed';
16 this._resolve(packet);
17 };
18
19 this.block = (error) => {
20 if (this.outcome) {
21 throw new InvalidActionError(`AGAction ${this.type} has already been ${this.outcome}; cannot block`);
22 }
23 this.outcome = 'blocked';
24 this._reject(error);
25 };
26}
27
28AGAction.prototype.HANDSHAKE_WS = AGAction.HANDSHAKE_WS = 'handshakeWS';
29AGAction.prototype.HANDSHAKE_SC = AGAction.HANDSHAKE_SC = 'handshakeSC';

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…