This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Lots of code was copied from https://msdn.microsoft.com/en-us/library/ff802693.aspx#serial_topic3 | |
| #include <assert.h> | |
| #include <windows.h> | |
| #include <stdio.h> | |
| #include <stdbool.h> | |
| void ReportStatusEvent(HANDLE port, DWORD s) | |
| { | |
| printf("event 0x%lx", s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loadJson(callback) { | |
| var XmlHttpRequest = new XMLHttpRequest(); | |
| XmlHttpRequest.overrideMimeType("application/json"); | |
| XmlHttpRequest.open('GET', 'file.json', true); | |
| XmlHttpRequest.onreadystatechange = function () { | |
| if (XmlHttpRequest.readyState == 4 && XmlHttpRequest.status == "200") { | |
| // .open will NOT return a value | |
| // but simply returns undefined in async mode so use a callback | |
| callback(XmlHttpRequest.responseText); | |
| } |