comparison Resources/CodeGeneration/template.in.ts @ 508:7105a0bad250 bgo-commands-codegen

- Added HandleSerializedMessage to IStoneApplication (empty impl) - Split UpdateWebApplication with "WithString" and "WithSerializedMessage" variants - Due to the modules in TS, globals are now unallowed and the callbacks from C++ to JS are stored in the "window" instance - Split UpdateStoneApplicationStatusFromCpp with "WithString" and "WithSerializedMessage" variants - Split NotifyStatusUpdateFromCppToWeb with "WithString" and "WithSerializedMessage" variants - SendMessageToStoneApplication (C++ global) has been split into SendSerializedMessageToStoneApplication and SendCommandToStoneApplication - In WasmPlatformApplicationAdapter: HandleMessageFromWeb becomes HandleCommandFromWeb - In WasmPlatformApplicationAdapter: added HandleSerializedMessageFromWeb - stonegentool now handles the "json" primitive type (used, a.o., in the VSOL "EditInstance" message) - Fixed indentation and added json serialization overloads in the stonegentool templates - Added test of the json primitive type to testWasmIntegrated (in Resources/CodeGeneration) - Adapted testWasmIntegrated (in Resources/CodeGeneration) to the changes above
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 06 Mar 2019 10:14:59 +0100
parents ce49eae4c887
children dea3787a8f4b
comparison
equal deleted inserted replaced
507:ce49eae4c887 508:7105a0bad250
42 {% for key in enum['fields']%}{{key}}, 42 {% for key in enum['fields']%}{{key}},
43 {%endfor%} 43 {%endfor%}
44 }; 44 };
45 {%endfor%} 45 {%endfor%}
46 46
47 {% for struct in structs%} export class {{struct['name']}} { 47 {% for struct in structs%}export class {{struct['name']}} {
48 {% if struct %} 48 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} {{key}}:{{CanonToTs(struct['fields'][key])}};
49 {% if struct['fields'] %} 49 {% endfor %}{% endif %}{% endif %}
50 {% for key in struct['fields']%}
51 {{key}}:{{CanonToTs(struct['fields'][key])}};
52 {% endfor %}
53 {% endif %}
54 {% endif %}
55 constructor() { 50 constructor() {
56 {% if struct %} 51 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%}{% if NeedsTsConstruction(enums,CanonToTs(struct['fields'][key])) %} this.{{key}} = new {{CanonToTs(struct['fields'][key])}}();
57 {% if struct['fields'] %} 52 {% endif %}{% endfor %}{% endif %}{% endif %} }
58 {% for key in struct['fields']%}
59 {% if NeedsTsConstruction(enums,CanonToTs(struct['fields'][key])) %}
60 this.{{key}} = new {{CanonToTs(struct['fields'][key])}}();
61 {% endif %}
62 {% endfor %}
63 {% endif %}
64 {% endif %}
65 }
66 53
67 public StoneSerialize(): string { 54 public StoneSerialize(): string {
68 let container: object = {}; 55 let container: object = {};
69 container['type'] = '{{rootName}}.{{struct['name']}}'; 56 container['type'] = '{{rootName}}.{{struct['name']}}';
70 container['value'] = this; 57 container['value'] = this;