Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Start putting in the framework for developing the javascript kernel
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <html> | ||
| <head> | ||
| <title>Niecza/JS test harness</title> | ||
| <script src="niecza.js"></script> | ||
| <script>Niecza.Serialization.loadSerFile('CORE.ser', function(){});</script> | ||
| </head> | ||
| <body> | ||
| </body> | ||
| </html> |
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // This will be moved to m4 later | ||
|
|
||
| (function() { | ||
|
|
||
| var Niecza = {}; | ||
|
|
||
| var NSer = Niecza.Serialization = {}; | ||
|
|
||
| var NSThaw = Niecza.Serialization.Thaw = function (buffer, callback) { | ||
| this.buffer = buffer; | ||
| this.view = new DataView(buffer); | ||
| this.offset = 0; | ||
| }; | ||
|
|
||
| NSThaw.prototype.$className = 'Niecza.Serialization.Thaw'; | ||
|
|
||
|
|
||
| NSer.loadSerFileEnd = function(ev) { | ||
| var xhr = ev.target, | ||
| cb = xhr.nieczaCallback; | ||
| if (xhr.status >= 200 && xhr.status < 300) { | ||
| new NSThaw(xhr.response, cb); | ||
| } else { | ||
| cb(false, xhr.statusText, xhr); | ||
| } | ||
| }; | ||
|
|
||
| NSer.loadSerFile = function (url, callback) { | ||
| var xhr = new XMLHttpRequest(); | ||
| xhr.responseType = 'arraybuffer'; | ||
| xhr.onloadend = NSer.loadSerFileEnd; | ||
| xhr.nieczaCallback = callback; | ||
| xhr.open('GET', url); | ||
| xhr.send(null); | ||
| }; | ||
|
|
||
| window.Niecza = Niecza; | ||
|
|
||
| })(); |