src/Store/Connection/Queue/QueueMessage.ts   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 31
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2
mnd 0
bc 0
fnc 2
bpm 0
cpm 1
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A QueueMessage.addCallback 0 3 1
A QueueMessage.execute 0 4 1
1
/**
2
 *
3
 */
4
import {ModelInterface, ModelStaticInterface, QueueAble} from "../../../JeloquentInterfaces";
5
6
export default class QueueMessage implements QueueAble {
7
8
    private action: string;
9
10
    private callback: CallableFunction;
11
12
    private data: object|Array<object>;
13
14
    private model: ModelInterface|ModelStaticInterface;
15
16
    constructor(model: ModelInterface|ModelStaticInterface, action: string, data:object|Array<object>) {
17
        this.model = model;
18
        this.action = action;
19
        this.data = data;
20
        this.callback = () => null;
21
    }
22
23
    addCallback(callback: CallableFunction): void {
24
        this.callback = callback;
25
    }
26
27
    execute(): void {
28
        this.model[this.action](this.data);
29
        this.callback();
30
    }
31
}