-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Expected Behavior
VMF.readData() should return message JSON for current instance of VMF
Current Behavior
An undefined exception is thrown: undefined is not an object (evaluating 'bytearray[readByte].toString')
Possible Solution
Ensure that VMF is reading its own binary member variable
Steps to Reproduce
- Create a message using a message object
myMessageObject - Set message on current
VMFinstance using.setMessage(myMessage) - Write message binary on current instance using
.writeMessageToBinary(myMessageObject) - Attempt to read back binary as json using message type `.readMessage(myMessageObject)
- Observe error message in console at
readData() vmf-parser.js:198
Context (Environment)
Per #3, it would be useful to have some additional exemplars of message objects. These seem straight forward but it would be useful to verify the correct json->binary conversion by converting back to JSON. It is when calling .readMessage(myMessageObject) to perform this verification that the error occurs.
Detailed Description
The fix is simple, the error does not occur in /dev/test.html because there is already an object called bytearray defined. The 'readData()' method in dist/vmf-parser.js needs to read its own .binary property which is already a bytearray
Possible Implementation
function readData(){
var octet = selfBinary[readByte].toString(2)
...
At line 253:
var selfBinary = this.binary;
var message = read(messagetype.items);
...