Index

lognestmonster / 4397a13

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
3125 Dec 2018 23:5678129ceUpdate event.jsJoshua155N

Blob @ lognestmonster / src / event.js

application/javascript712 bytesdownload raw
1const Statement = require("./statement.js");
2
3class Event {
4 constructor() {
5 this.statements = [];
6 if (arguments.length > 0) this.push(arguments[0], arguments[1], arguments[2]);
7 return this;
8 }
9
10 push() {
11 if (arguments.length == 1) {
12 if (arguments[0] instanceof Event && arguments[0] != this) this.statements.push(arguments[0].statements);
13 else if (arguments[0] instanceof Statement) this.Statements.push(arguments[0]);
14 else throw new TypeError("Expected an Event or Statement");
15 }
16 else if (arguments.length == 3) this.statements.push(new Statement(arguments[0], arguments[1], arguments[2]));
17 else throw new Error("Expected 1 or 3 arguments");
18 return this;
19 }
20}
21
22module.exports = Event;
23