const _index = [];

let freeId = 0;

export function addEvent (time, callback) {
    // Adds an event to the timeline and returns its ID. Accepts an optional callback function as a parameter.
    _index.push({
        id: freeId,
        callback: callback
    });
    freeId++;
    return freeId - 1;
}

export function removeEvent (id) {
    // Removes the event with the given ID from the timeline.
    let result = _index.filter((obj) => obj.id === id);
    if (result) _index.splice(_index.indexOf(result), 1);
}

export function play () {
    // Begins playback from the current position.
}

export function pause () {
    // Pauses playback at the current position.
}

export function seek () {
    // Seeks the timeline to the specified position.
}
@@ -1,56 +1,103 @@
 c
-onst _index = %5B%5D;%0A%0Alet freeId = 0;%0A%0Aexport function
+lass BulletTime %7B%0A    constructor() %7B%0A        this.index = %5B%5D;%0A        this.freeId = 0;%0A    %7D%0A%0A   
  add
@@ -101,17 +101,16 @@
 addEvent
- 
 (time, c
@@ -116,24 +116,28 @@
 callback) %7B%0A
+    
     // Adds 
@@ -239,17 +239,25 @@
 er.%0A    
-_
+    this.
 index.pu
@@ -273,12 +273,21 @@
     
+ 
+   
 id: 
+this.
 free
@@ -298,16 +298,20 @@
         
+ 
+   
 callback
@@ -321,16 +321,20 @@
 allback%0A
+    
     %7D);%0A
@@ -337,16 +337,25 @@
 %7D);%0A    
+ 
+   this.
 freeId++
@@ -356,16 +356,20 @@
 eeId++;%0A
+    
     retu
@@ -371,16 +371,21 @@
  return 
+this.
 freeId -
@@ -388,34 +388,26 @@
 Id - 1;%0A
-%7D%0A%0Aexport function
+    %7D%0A%0A   
  removeE
@@ -414,16 +414,19 @@
 vent
- 
 (id) %7B%0A
+    
     
@@ -483,16 +483,20 @@
 meline.%0A
+    
     let 
@@ -504,17 +504,21 @@
 esult = 
-_
+this.
 index.fi
@@ -547,16 +547,20 @@
 == id);%0A
+    
     if (
@@ -567,17 +567,21 @@
 result) 
-_
+this.
 index.sp
@@ -589,9 +589,13 @@
 ice(
-_
+this.
 inde
@@ -621,37 +621,32 @@
 1);%0A
-%7D%0A%0Aexport function
+    %7D%0A%0A   
  play
- 
 () %7B%0A
+    
     
@@ -695,33 +695,24 @@
 on.%0A
-%7D%0A%0Aexport function
+    %7D%0A%0A   
  pause
- 
 () %7B
@@ -716,16 +716,20 @@
 ) %7B%0A    
+  
+  
 // Pause
@@ -768,37 +768,32 @@
 on.%0A
-%7D%0A%0Aexport function
+    %7D%0A%0A   
  seek
- 
 () %7B%0A
+    
     
@@ -841,9 +841,15 @@
 sition.%0A
+    %7D%0A
 %7D

Converted to ES6 class