mirror of
https://github.com/esiur/esiur-js.git
synced 2025-06-26 23:03:13 +00:00
1.6.0
This commit is contained in:
77
test/app.js
77
test/app.js
@ -1,77 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var demo = null;
|
||||
|
||||
class JSResource extends IResource
|
||||
{
|
||||
static get template()
|
||||
{
|
||||
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);
|
||||
});
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
export * from "../src/IEventHandler.js";
|
||||
export * from "../src/IDestructible.js";
|
||||
export * from "../src/IResource.js";
|
@ -1,8 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script src='test.js' type="module"></script>
|
||||
</head>
|
||||
|
||||
</body>
|
||||
</html>
|
30
test/test.js
30
test/test.js
@ -1,30 +0,0 @@
|
||||
var demo;
|
||||
|
||||
import IStore from '../src/Resource/IStore.js';
|
||||
import wh from '../src/esiur.js';
|
||||
|
||||
class MyStore extends IStore
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
async function load()
|
||||
{
|
||||
// window.x = await wh.get("iip://localhost:5001/db/my", {username: "demo", password: "1234"});
|
||||
window.x = await wh.get("iip://chat.go.iq:5001/sys/hd", {username: "admin", password: "delta"});
|
||||
|
||||
console.log(window.x);
|
||||
}
|
||||
|
||||
load();
|
||||
|
||||
/*
|
||||
wh.get("iip://localhost:5001/db/my", {username: "demo", password: "1234"})
|
||||
.then(x=>{
|
||||
console.log("connected", x);
|
||||
|
||||
window.x = x;
|
||||
}).catch(x=>{
|
||||
console.log("error", x);
|
||||
});
|
||||
*/
|
Reference in New Issue
Block a user