OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::web_hosting::anonymous_namespace{WebHosting.cpp} Namespace Reference

Variables

constexpr char ORCA_BRIDGE_JS []

Variable Documentation

◆ ORCA_BRIDGE_JS

char Slic3r::GUI::web_hosting::anonymous_namespace{WebHosting.cpp}::ORCA_BRIDGE_JS[]
constexpr
Initial value:
= R"JS(
(function () {
if (window.top !== window.self) return;
if (window.orca) return;
var handlers = [];
function send(kind, data) {
try {
window.wx.postMessage(JSON.stringify({
channel: 'orca', kind: kind, data: (data === undefined ? null : data)
}));
} catch (e) { /* bridge not ready yet */ }
}
window.orca = {
postMessage: function (d) { send('message', d); },
submit: function (d) { send('submit', d); },
close: function () { send('close'); },
onMessage: function (cb) { if (typeof cb === 'function') handlers.push(cb); }
};
window.__orcaDispatch = function (payload) {
var data = payload ? payload.data : null;
for (var i = 0; i < handlers.length; i++) {
try { handlers[i](data); } catch (e) {}
}
};
})();
)JS"