2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-06-26 23:03:13 +00:00
This commit is contained in:
2019-06-07 23:07:15 +03:00
parent 054a4a0bd8
commit 144db9ee8b
100 changed files with 25137 additions and 1552 deletions

77
test/app.js Normal file
View File

@ -0,0 +1,77 @@
"use strict";
var demo = null;
class JSResource extends IResource
{
static getTemplate()
{
return {
namespace: "JS",
properties: [{name: "message", recordable: true}],
functions: [{name: "send", void: true, expansion: null}],
events: [{name: "published", expansion: null}]
}
}
constructor()
{
super();
this.message = "hi";
}
send(message)
{
console.log(message);
}
}
function init() {
var local = new MemoryStore();
var con = new DistributedConnection("ws://localhost:5001/iip/system/iip", "localhost", "demo", "1234");
Warehouse.put(con, "remote");
Warehouse.put(local, "local");
Warehouse.put(new JSResource(), "js", local);
con.on("ready", async function (d) {
// var list = await con.query("").task;
// console.log(list);
// debugger;
Warehouse.get("remote/db/my").then(async function(rt){
console.log("Object received.");
demo = rt;
rt.on("LevelUp", function(v){
console.log("LevelUp", v);
});
con.getRecord(rt, new Date(new Date() - 60000000), new Date()).then(function(h){
console.log(h);
});
var l = await rt.Subtract(3).task;
console.log("Await", l);
//rt.Stream(10).then(x=> console.log("finished S"))
// .chunk(x => console.log ("chunk", x))
// .progress((x,y,z) => console.log("progress", x, y, z));
//rt.Enum(4).then(x=> console.log("Enum finished"))
// .chunk(x => console.log ("Enum chunk", x))
// .progress((x,y,z) => console.log("progress", x, y, z));
});
}).on("error", function(sender, code, msg){
console.log(sender, code, msg);
});
}

5
test/import.js Normal file
View File

@ -0,0 +1,5 @@
"use strict";
export * from "../src/IEventHandler.js";
export * from "../src/IDestructible.js";
export * from "../src/IResource.js";

37
test/test-debug.html Normal file
View File

@ -0,0 +1,37 @@
<html>
<head>
<script src="../build/esiur-debug.js"></script>
<script>
var demo;
class MyStore extends IStore
{
}
function init() {
var con = new DistributedConnection("ws://localhost:5001/iip/system/iip", "localhost", "ahmed", "password");
Warehouse.put(con, "remote");
con.on("ready", function (d) {
con.get("db/my").then(function(rt){
console.log("Object received.");
demo = rt;
rt.on("LevelUp", function(v){
console.log("LevelUp", v);
});
rt.Add(3);
});
}).on("error", function(sender, code, msg){
console.log(sender, code, msg);
});
}
</script>
</head>
<body onload="init()">
</body>
</html>

59
test/test-plain.html Normal file
View File

@ -0,0 +1,59 @@
<html>
<head>
<script src="../src/IEventHandler.js"></script>
<script src="../src/IDestructible.js"></script>
<script src="../src/AutoList.js"></script>
<script src="../src/KeyList.js"></script>
<script src="../src/PropertyValue.js"></script>
<script src="../src/IResource.js"></script>
<script src="../src/IStore.js"></script>
<script src="../src/Structure.js"></script>
<script src="../src/StructureArray.js"></script>
<script src="../src/ResourceArray.js"></script>
<script src="../src/MemberTemplate.js"></script>
<script src="../src/AsyncReply.js"></script>
<script src="../src/AsyncException.js"></script>
<script src="../src/Authentication.js"></script>
<script src="../src/Session.js"></script>
<script src="../src/IPermissionsManager.js"></script>
<script src="../src/AsyncBag.js"></script>
<script src="../src/AsyncQueue.js"></script>
<script src="../src/BinaryList.js"></script>
<script src="../src/Codec.js"></script>
<script src="../src/DataConverter.js"></script>
<script src="../src/SHA256.js"></script>
<script src="../src/DataType.js"></script>
<script src="../src/DistributedConnection.js"></script>
<script src="../src/DistributedResource.js"></script>
<script src="../src/DistributedResourceQueueItem.js"></script>
<script src="../src/EventTemplate.js"></script>
<script src="../src/FunctionTemplate.js"></script>
<script src="../src/Guid.js"></script>
<script src="../src/IIPAuthPacket.js"></script>
<script src="../src/IIPPacket.js"></script>
<script src="../src/Instance.js"></script>
<script src="../src/NetworkBuffer.js"></script>
<script src="../src/NotModified.js"></script>
<script src="../src/PropertyTemplate.js"></script>
<script src="../src/ResourceTemplate.js"></script>
<script src="../src/SendList.js"></script>
<script src="../src/Warehouse.js"></script>
<script src="../src/MemoryStore.js"></script>
<script src="app.js"></script>
<script>
</script>
</head>
<body onload="init()">
</body>
</html>

37
test/test.html Normal file
View File

@ -0,0 +1,37 @@
<html>
<head>
<script src="../build/esiur.js"></script>
<script>
var demo;
class MyStore extends IStore
{
}
function init() {
var con = new DistributedConnection("ws://localhost:5001/iip/system/iip", "localhost", "ahmed", "password");
Warehouse.put(con, "remote");
con.on("ready", function (d) {
con.get("db/my").then(function(rt){
console.log("Object received.");
demo = rt;
rt.on("LevelUp", function(v){
console.log("LevelUp", v);
});
rt.Add(3);
});
}).on("error", function(sender, code, msg){
console.log(sender, code, msg);
});
}
</script>
</head>
<body onload="init()">
</body>
</html>