- merged offline functionality
- added emscripten makefile
This commit is contained in:
parent
63260b2dee
commit
08a6d31d32
9 changed files with 137424 additions and 53 deletions
26
js/sweph.js
Normal file
26
js/sweph.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
self.Module = {
|
||||
locateFile: function (s) {
|
||||
return s;
|
||||
},
|
||||
// Add this function
|
||||
onRuntimeInitialized: function() {
|
||||
var query = get();
|
||||
postMessage(query);
|
||||
}
|
||||
};
|
||||
|
||||
self.importScripts("pmom.js");
|
||||
|
||||
self.data = {};
|
||||
|
||||
// to pass data from the main JS file
|
||||
self.onmessage = function(messageEvent) {
|
||||
self.data = messageEvent.data; // save the data
|
||||
}
|
||||
|
||||
// gets executed when everything is ready.
|
||||
self.get = function() {
|
||||
var calc = self.Module.ccall('get', 'string', ['number', 'number', 'number', 'number'], [self.data[0], self.data[1], self.data[2], self.data[3]]);
|
||||
var result = JSON.parse(calc);
|
||||
return result.query;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue