2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-06-26 23:03:13 +00:00

Generator

This commit is contained in:
2022-09-03 03:08:57 +03:00
parent f08df2c3fa
commit 93ed4edcbd
26 changed files with 1377 additions and 238 deletions

View File

@ -10,6 +10,8 @@ import DC from "../../src/Data/DC.js";
import IResource from "../../src/Resource/IResource.js";
import TransmissionType, { TransmissionTypeIdentifier } from "../../src/Data/TransmissionType.js";
import TypedMap from "../../src/Data/TypedMap.js";
import { Arg, Evt, Func, Prop, TemplateDescriber } from "../../src/Resource/Template/TemplateDescriber.js";
import { Int32 } from "../../src/Data/ExtendedTypes.js";
const require = createRequire(import.meta.url);
@ -36,7 +38,7 @@ var server;
class MyChat extends IResource {
// void (string, string)->void
static get template() {
static get templateOld() {
return {
namespace: "Chat",
properties: [["title", String], ["messages", Array], ["users", Array]],
@ -45,6 +47,14 @@ class MyChat extends IResource {
};
}
static get template() {
return new TemplateDescriber("Chat",[
new Prop("title", String), new Prop("messages", Array), new Prop("users", Array),
new Func("send", null, [new Arg("msg", String, true)]),
new Evt("message", Map), new Evt("voice", Int32, true), new Evt("login"), new Evt("logout")]
);
}
constructor() {
super();
this.messages = [new TypedMap({usr: "Admin", msg: "Welcome to Esiur", date: new Date()})];

View File

@ -10,13 +10,12 @@ import DC from "../../src/Data/DC.js";
import IResource from "../../src/Resource/IResource.js";
import Structure from "../../src/Data/Structure.js";
import MongoDBStore from "../../src/Stores/MongoDBStore.js";
import { Prop, TemplateDescriber } from "../../src/Resource/Template/TemplateDescriber.js";
class User extends IResource {
static get template() {
return {
properties: [{name: "username"}, {name: "password"}]
};
return new TemplateDescriber("Esiur", [new Prop("username", String), new Prop("password", String)]);
}
}