2
0
mirror of https://github.com/esiur/esiur-js.git synced 2026-03-18 15:30:38 +00:00

Annotations

This commit is contained in:
2022-06-16 04:51:43 +03:00
parent 89d8e5b627
commit fffce4d595
7 changed files with 101 additions and 54 deletions

View File

@@ -124,6 +124,7 @@ export default class DistributedConnection extends IStore {
this.requests = new KeyList();// {};
//this.pathRequests = new KeyList();// {};
this.templateRequests = new KeyList();
this.templateByNameRequests = new KeyList();
this.resourceRequests = new KeyList();// {};
this.callbackCounter = 0;
@@ -2260,6 +2261,36 @@ export default class DistributedConnection extends IStore {
return reply;
}
getTemplateByClassName(className) {
let template = this.templates.find((x)=>x.className == className);
if (template != null)
return new AsyncReply(template);
else if (this.templateByNameRequests.contains(className))
return this.templateByNameRequests.item(className);
var reply = new AsyncReply();
this.templateByNameRequests.add(className, reply);
var self = this;
let classNameBytes = DC.stringToBytes(className);
this.sendRequest(IIPPacketAction.TemplateFromClassName)
.addUint8(classNameBytes.length)
.addUint8Array(classNameBytes)
.done()
.then(function (rt) {
self.templateByNameRequests.remove(className);
self.templates.add(rt[0].classId.valueOf(), rt[0]);
Warehouse.putTemplate(rt[0]);
reply.trigger(rt[0]);
});
return reply;
}
getTemplate(classId) {
if (this.templates.contains(classId))
return new AsyncReply(this.templates.item(classId));

View File

@@ -145,8 +145,8 @@ export default class DistributedResource extends IResource
}
};
// get expansion
func.help = self.instance.template.functions[ft.index].expansion;
// get annotation
func.help = self.instance.template.functions[ft.index].annotation;
return func;
};