mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-06-27 14:53:11 +00:00
Rename
This commit is contained in:
@ -1,12 +1,17 @@
|
||||
import "package:test/test.dart";
|
||||
import 'package:esiur/esiur.dart';
|
||||
import 'package:esyur/esyur.dart';
|
||||
import 'dart:io';
|
||||
|
||||
main()
|
||||
{
|
||||
test("Connect to server", () async {
|
||||
|
||||
|
||||
// connect to the server
|
||||
var x = await Warehouse.get("iip://localhost:5000/db/my", {"username": "demo", "password": "1234"});
|
||||
|
||||
// x.instance.store.on("close", ()=>print("Closed"));
|
||||
|
||||
|
||||
// get property
|
||||
print(x.Level);
|
||||
@ -17,10 +22,54 @@ main()
|
||||
// use named arguments
|
||||
print(await x.Add(value: 20));
|
||||
// test chunks
|
||||
x.Stream(10).chunk((c)=>print(c));
|
||||
//x.Stream(10).chunk((c)=>print(c));
|
||||
// property setter
|
||||
x.Level += 900;
|
||||
//x.Level += 900;
|
||||
|
||||
|
||||
//var msg = await stdin.readLineSync();
|
||||
|
||||
print("Done");
|
||||
|
||||
print("Done");
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// describe object
|
||||
desc(dynamic x) {
|
||||
if (x is List)
|
||||
{
|
||||
for(var i = 0; i < x.length; i++)
|
||||
desc(x[i]);
|
||||
}
|
||||
else if (x is DistributedResource)
|
||||
{
|
||||
var y = x.instance.template;
|
||||
print("Fucntions = ${y.functions.length}\n");
|
||||
for (var i = 0; i < y.functions.length; i++) {
|
||||
print("name = ${y.functions[i].name}");
|
||||
print("args = ${y.functions[i].expansion}");
|
||||
}
|
||||
print("------------------------------\n");
|
||||
print("Events = ${y.events.length}\n");
|
||||
for (var i = 0; i < y.events.length; i++) {
|
||||
print("name = ${y.events[i].name}");
|
||||
print("args = ${y.events[i].expansion}");
|
||||
}
|
||||
|
||||
print("------------------------------\n");
|
||||
print("Properties = ${y.properties.length}\n");
|
||||
for (var i = 0; i < y.properties.length; i++) {
|
||||
print("name = ${y.properties[i].name}");
|
||||
// recursion
|
||||
print("value = ${desc(x.get(y.properties[i].index))}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print(x.toString());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user