encapsulate kiri client
This commit is contained in:
parent
f8c8f73349
commit
ffd2f440ba
4 changed files with 9 additions and 5 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
// this code runs in kiri's main loop
|
||||
let KIRI = self.kiri = self.kiri || {},
|
||||
loc = self.location,
|
||||
|
|
@ -224,3 +226,5 @@ KIRI.work = {
|
|||
|
||||
// start worker
|
||||
KIRI.work.restart();
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -200,17 +200,17 @@ self.kiri.loader.push(function() {
|
|||
if (KIRI.client)
|
||||
KIRI.client.animate_setup = function(settings, ondone) {
|
||||
unitScale = settings.controller.units === 'in' ? 1/25.4 : 1;
|
||||
send("animate_setup", {settings}, ondone);
|
||||
KIRI.client.send("animate_setup", {settings}, ondone);
|
||||
};
|
||||
|
||||
if (KIRI.client)
|
||||
KIRI.client.animate = function(data, ondone) {
|
||||
send("animate", data, ondone);
|
||||
KIRI.client.send("animate", data, ondone);
|
||||
};
|
||||
|
||||
if (KIRI.client)
|
||||
KIRI.client.animate_cleanup = function(data, ondone) {
|
||||
send("animate_cleanup", data, ondone);
|
||||
KIRI.client.send("animate_cleanup", data, ondone);
|
||||
};
|
||||
|
||||
// ---( WORKER FUNCTIONS )---
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
KIRI.client.sync();
|
||||
let settings = API.conf.get();
|
||||
let widgets = API.widgets.map();
|
||||
send("cam_traces", { settings }, output => {
|
||||
KIRI.client.send("cam_traces", { settings }, output => {
|
||||
let ids = [];
|
||||
KIRI.codec.decode(output).forEach(rec => {
|
||||
ids.push(rec.id);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
KIRI.client.sync();
|
||||
let settings = API.conf.get();
|
||||
let widgets = API.widgets.map();
|
||||
send('fdm_support_generate', { settings }, (gen) => {
|
||||
KIRI.client.send("fdm_support_generate", { settings }, (gen) => {
|
||||
for (let g of gen) g.widget = widgets[g.id];
|
||||
ondone(gen);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue