move some stats to events
This commit is contained in:
parent
e13add0949
commit
194284f16d
3 changed files with 8 additions and 13 deletions
|
|
@ -24,7 +24,7 @@ let gs_kiri_export = exports;
|
||||||
function exportPrint() {
|
function exportPrint() {
|
||||||
let currentPrint = API.print.get();
|
let currentPrint = API.print.get();
|
||||||
if (currentPrint) {
|
if (currentPrint) {
|
||||||
STATS.add(`ua_${API.mode.get_lower()}_export`);
|
API.event.emit('export', API.mode.get());
|
||||||
switch (API.mode.get()) {
|
switch (API.mode.get()) {
|
||||||
case 'LASER': return exportPrintLaser(currentPrint);
|
case 'LASER': return exportPrintLaser(currentPrint);
|
||||||
case 'FDM': return exportPrintGCODE(currentPrint);
|
case 'FDM': return exportPrintGCODE(currentPrint);
|
||||||
|
|
|
||||||
|
|
@ -539,10 +539,10 @@ var gs_kiri_init = exports;
|
||||||
|
|
||||||
function setDeviceCode(code, devicename) {
|
function setDeviceCode(code, devicename) {
|
||||||
try {
|
try {
|
||||||
STATS.set(`ud_${API.mode.get_lower()}`, devicename);
|
|
||||||
|
|
||||||
if (typeof(code) === 'string') code = js2o(code) || {};
|
if (typeof(code) === 'string') code = js2o(code) || {};
|
||||||
|
|
||||||
|
API.event.emit('device.set', devicename);
|
||||||
|
|
||||||
let mode = API.mode.get(),
|
let mode = API.mode.get(),
|
||||||
current = settings(),
|
current = settings(),
|
||||||
local = isLocalDevice(devicename),
|
local = isLocalDevice(devicename),
|
||||||
|
|
@ -968,8 +968,6 @@ var gs_kiri_init = exports;
|
||||||
|
|
||||||
API.dialog.show('tools');
|
API.dialog.show('tools');
|
||||||
UI.toolSelect.focus();
|
UI.toolSelect.focus();
|
||||||
|
|
||||||
STATS.add('ua_get_tools');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDevices() {
|
function showDevices() {
|
||||||
|
|
@ -978,7 +976,6 @@ var gs_kiri_init = exports;
|
||||||
API.ajax("/api/filters-"+API.mode.get_lower(), function(flvalue) {
|
API.ajax("/api/filters-"+API.mode.get_lower(), function(flvalue) {
|
||||||
if (!flvalue) return;
|
if (!flvalue) return;
|
||||||
renderDevices(js2o(flvalue));
|
renderDevices(js2o(flvalue));
|
||||||
STATS.add('ua_get_devs');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1743,6 +1740,7 @@ var gs_kiri_init = exports;
|
||||||
scr.setAttribute('src','/code/'+lib+'.js');
|
scr.setAttribute('src','/code/'+lib+'.js');
|
||||||
DOC.body.appendChild(scr);
|
DOC.body.appendChild(scr);
|
||||||
STATS.add('load_'+lib);
|
STATS.add('load_'+lib);
|
||||||
|
API.event.emit('load.lib', lib);
|
||||||
});
|
});
|
||||||
|
|
||||||
// load CSS extensions
|
// load CSS extensions
|
||||||
|
|
|
||||||
11
js/kiri.js
11
js/kiri.js
|
|
@ -684,8 +684,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
|
|
||||||
currentPrint.render();
|
currentPrint.render();
|
||||||
|
|
||||||
// on done
|
API.event.emit('print', getMode());
|
||||||
STATS.add(`ua_${getModeLower()}_print`);
|
|
||||||
SPACE.platform.add(currentPrint.group);
|
SPACE.platform.add(currentPrint.group);
|
||||||
SPACE.update();
|
SPACE.update();
|
||||||
|
|
||||||
|
|
@ -774,7 +773,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
// update segment time
|
// update segment time
|
||||||
if (lastMsg) segtimes[segNumber+"_"+lastMsg] = mark - startTime;
|
if (lastMsg) segtimes[segNumber+"_"+lastMsg] = mark - startTime;
|
||||||
DBUG.log(segtimes);
|
DBUG.log(segtimes);
|
||||||
STATS.add(`ua_${getModeLower()}_slice`);
|
API.event.emit('slice', getMode());
|
||||||
updateSliderMax(true);
|
updateSliderMax(true);
|
||||||
if (preserveMax != API.var.layer_max) {
|
if (preserveMax != API.var.layer_max) {
|
||||||
preserveLayer = API.var.layer_max;
|
preserveLayer = API.var.layer_max;
|
||||||
|
|
@ -1757,7 +1756,6 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
hideDialog();
|
hideDialog();
|
||||||
if (!local) {
|
if (!local) {
|
||||||
WIN.open("//wiki.grid.space/wiki/Kiri:Moto", "_help");
|
WIN.open("//wiki.grid.space/wiki/Kiri:Moto", "_help");
|
||||||
STATS.add('ua_help');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ajax(local, function(html) {
|
ajax(local, function(html) {
|
||||||
|
|
@ -1765,8 +1763,8 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
$('help-close').onclick = hideModal;
|
$('help-close').onclick = hideModal;
|
||||||
$('kiri-version').innerHTML = `<i>${LANG.version} ${KIRI.version}</i>`;
|
$('kiri-version').innerHTML = `<i>${LANG.version} ${KIRI.version}</i>`;
|
||||||
showModal('help');
|
showModal('help');
|
||||||
STATS.add('ua_help');
|
|
||||||
});
|
});
|
||||||
|
API.event.emit('help.show', local);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLocal() {
|
function showLocal() {
|
||||||
|
|
@ -1883,8 +1881,6 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
if (settings.cdev[mode]) {
|
if (settings.cdev[mode]) {
|
||||||
settings.device = clone(settings.cdev[mode]);
|
settings.device = clone(settings.cdev[mode]);
|
||||||
}
|
}
|
||||||
// update device stat for FDM/CAM
|
|
||||||
STATS.set(`ud_${getModeLower()}`, settings.filter[mode] || 'default');
|
|
||||||
MODE = MODES[mode];
|
MODE = MODES[mode];
|
||||||
// updates right-hand menu by enabling/disabling fields
|
// updates right-hand menu by enabling/disabling fields
|
||||||
UC.setMode(MODE);
|
UC.setMode(MODE);
|
||||||
|
|
@ -1910,6 +1906,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
if (settings.device.new) {
|
if (settings.device.new) {
|
||||||
API.show.devices();
|
API.show.devices();
|
||||||
}
|
}
|
||||||
|
API.event.emit("mode.set", mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSkipSliceView() {
|
function updateSkipSliceView() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue