-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benedikt Strehle
committed
Sep 29, 2024
1 parent
ace77c6
commit abf573f
Showing
3 changed files
with
152 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
export default <> | ||
Hello DATEX | ||
</> | ||
|
||
|
||
import { Datex, property } from "datex-core-legacy/datex.ts"; | ||
import { inferType, StorageSet } from 'datex-core-legacy/datex_all.ts'; | ||
|
||
const C = 0; | ||
|
||
@sync class A { | ||
@property a!: number; | ||
construct() { | ||
this.a = 42; | ||
} | ||
} | ||
@sync class B extends A { | ||
@property b!: number; | ||
construct() { | ||
super.construct(); | ||
this.b = 69; | ||
} | ||
} | ||
|
||
const list = eternalVar("tmp1-"+C) ?? $$(new StorageSet<A>()); | ||
if (await list.getSize() === 0) { | ||
await list.add(new A()); | ||
await list.add(new B()); | ||
} | ||
for await (const entry of list) { | ||
console.log(entry,entry.a, entry.b) | ||
} | ||
console.log("") | ||
|
||
|
||
// { // Structs | ||
// const A = struct('A', | ||
// class { | ||
// @property a!: number; | ||
// construct() { | ||
// console.log("contrucst A") | ||
// this.a = 42; | ||
// } | ||
// } | ||
// ) | ||
// type A = inferType<typeof A>; | ||
|
||
// const B = struct('B', | ||
// class extends A { | ||
// @property b!: number; | ||
// construct() { | ||
// super.construct(); | ||
// this.b = 69; | ||
// } | ||
// } | ||
// ) | ||
// type B = inferType<typeof B>; | ||
// const list = eternalVar("tmp2-"+C) ?? $$(new StorageSet<A>()); | ||
// if (await list.getSize() === 0) { | ||
// await list.add(new A()); | ||
// await list.add(new B()); | ||
// } | ||
// for await (const entry of list) { | ||
// console.log(entry, entry.a, entry.b) | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.