directly pass round-basal to V8

This commit is contained in:
AdrianLxM 2017-01-25 10:02:35 +01:00
parent 53c63f0f48
commit 805f23fe59

View file

@ -139,8 +139,7 @@ public class DetermineBasalAdapterAMAJS {
} }
private void loadScript() throws IOException { private void loadScript() throws IOException {
mV8rt.executeVoidScript(readFile("OpenAPSAMA/round-basal.js"), "OpenAPSAMA/round-basal.js", 0); mV8rt.executeVoidScript("var round_basal = function round_basal(basal, profile) { return basal; };");
mV8rt.executeVoidScript("var round_basal = module.exports;");
mV8rt.executeVoidScript("require = function() {return round_basal;};"); mV8rt.executeVoidScript("require = function() {return round_basal;};");
mV8rt.executeVoidScript(readFile("OpenAPSAMA/basal-set-temp.js"), "OpenAPSAMA/basal-set-temp.js ", 0); mV8rt.executeVoidScript(readFile("OpenAPSAMA/basal-set-temp.js"), "OpenAPSAMA/basal-set-temp.js ", 0);