mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2025-07-13 14:14:27 +02:00
add lua playground package
This commit is contained in:
3
LuaPlayground/build/debug/README.md
Normal file
3
LuaPlayground/build/debug/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
#LuaPlayground
|
||||
|
||||
Application for serverside code testing and analytics tool
|
19
LuaPlayground/build/debug/main.css
Normal file
19
LuaPlayground/build/debug/main.css
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
afx-app-window[data-id="LuaPlayground"] div[data-id="output"] p{
|
||||
margin:0;
|
||||
padding:0;
|
||||
font-family: "HermitLight";
|
||||
text-align: left;
|
||||
}
|
||||
afx-app-window[data-id="LuaPlayground"] div[data-id="output"]{
|
||||
background-color: #2f3129;
|
||||
padding: 10px;
|
||||
padding-left: 40px;
|
||||
color:white;
|
||||
overflow: auto;
|
||||
}
|
||||
afx-app-window[data-id="LuaPlayground"] afx-resizer{
|
||||
border-top: 1px solid #a6a6a6;
|
||||
background-color: #2f3129;
|
||||
border-right: 0;
|
||||
}
|
99
LuaPlayground/build/debug/main.js
Normal file
99
LuaPlayground/build/debug/main.js
Normal file
@ -0,0 +1,99 @@
|
||||
(function() {
|
||||
var LuaPlayground;
|
||||
|
||||
LuaPlayground = class LuaPlayground extends this.OS.GUI.BaseApplication {
|
||||
constructor(args) {
|
||||
super("LuaPlayground", args);
|
||||
}
|
||||
|
||||
main() {
|
||||
var me;
|
||||
me = this;
|
||||
this.datarea = this.find("editorea");
|
||||
this.output = this.find("output");
|
||||
this.editor = ace.edit(this.datarea);
|
||||
this.editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableLiveAutocompletion: true,
|
||||
fontSize: "10pt"
|
||||
});
|
||||
this.editor.getSession().setUseWrapMode(true);
|
||||
this.editor.session.setMode("ace/mode/lua");
|
||||
this.editor.setTheme("ace/theme/monokai");
|
||||
this.on("vboxchange", function() {
|
||||
return me.editor.resize();
|
||||
});
|
||||
return this.socket = null;
|
||||
}
|
||||
|
||||
menu() {
|
||||
var me, menu;
|
||||
me = this;
|
||||
menu = [
|
||||
{
|
||||
text: "__(Code)",
|
||||
child: [
|
||||
{
|
||||
text: "__(Run)",
|
||||
dataid: `${this.name}-Run`,
|
||||
shortcut: "C-R"
|
||||
}
|
||||
],
|
||||
onmenuselect: function(e) {
|
||||
return me.run();
|
||||
}
|
||||
}
|
||||
];
|
||||
return menu;
|
||||
}
|
||||
|
||||
log(t, m) {
|
||||
var p;
|
||||
if (t === "clean") {
|
||||
return $(this.output).empty();
|
||||
}
|
||||
p = ($("<p>")).attr("class", t.toLowerCase())[0];
|
||||
$(p).html(`${t}: ${m.__()}`);
|
||||
($(this.output)).append(p);
|
||||
return ($(this.output)).scrollTop(this.output.scrollHeight);
|
||||
}
|
||||
|
||||
run() {
|
||||
var me, proto, value;
|
||||
me = this;
|
||||
value = this.editor.getValue().trim();
|
||||
if (!(value && value !== "")) {
|
||||
return;
|
||||
}
|
||||
proto = window.location.protocol === "https:" ? "wss://" : "ws://";
|
||||
this.socket = new WebSocket(proto + this._api.HOST + "/lua-api/os/apigateway?ws=1");
|
||||
this.socket.onopen = function() {
|
||||
//send data to server
|
||||
return me.socket.send(JSON.stringify({
|
||||
code: value
|
||||
}));
|
||||
};
|
||||
this.socket.onmessage = function(e) {
|
||||
if (e.data) {
|
||||
return me.log("INFO", e.data);
|
||||
}
|
||||
};
|
||||
return this.socket.onclose = function() {
|
||||
me.socket = null;
|
||||
return console.log("socket closed");
|
||||
};
|
||||
}
|
||||
|
||||
cleanup(e) {
|
||||
if (this.socket) {
|
||||
return this.socket.close();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.OS.dependencies = ["ace/ace"];
|
||||
|
||||
this.OS.register("LuaPlayground", LuaPlayground);
|
||||
|
||||
}).call(this);
|
13
LuaPlayground/build/debug/package.json
Normal file
13
LuaPlayground/build/debug/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"app":"LuaPlayground",
|
||||
"name":"LuaPlayground",
|
||||
"description":"Module testing and analytics tool",
|
||||
"info":{
|
||||
"author": "Xuan Sang LEs",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.0.1-a",
|
||||
"category":"System",
|
||||
"iconclass":"fa fa-adn",
|
||||
"mimes":["none"]
|
||||
}
|
7
LuaPlayground/build/debug/scheme.html
Normal file
7
LuaPlayground/build/debug/scheme.html
Normal file
@ -0,0 +1,7 @@
|
||||
<afx-app-window apptitle="Lua Playground" width="500" height="450" data-id="LuaPlayground">
|
||||
<afx-vbox >
|
||||
<div data-id="editorea"></div>
|
||||
<afx-resizer data-height="5"></afx-resizer>
|
||||
<div data-id="output"></div>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
Reference in New Issue
Block a user