-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNote for developers
More file actions
58 lines (43 loc) · 1.85 KB
/
Note for developers
File metadata and controls
58 lines (43 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Develop muTS on AMDModules' source files and use respective compilers.
You need node and typescript to compile the files.
Open your terminal and navigate to AMDModules directory. Run 'tsc -w' command to start compiler.
Test your changes by opening 'index.html' locally. No need for a web server.
Set muTSlog to true to enable verbose logging outside of demo page. (Type 'muTSlog = true' in console)
To prepare VanillaJS' source files, copy AMDModules' source and remove 'import' and 'export' stuff.
Check out the example below, you'll see what I mean.
Respective tsconfig.json's will deal with everything else.
EXAMPLE:
// ===AMDModules===
import MuBitConverter from "./MuBitConverter";
import IMuBinary from "./IMuBinary";
export default class MuSpring {
public Spring: number;
public Damper: number;
public TargetPosition: number;
constructor (array: IMuBinary) {
this.Spring = MuBitConverter.ReadFloat (array);
this.Damper = MuBitConverter.ReadFloat (array);
this.TargetPosition = MuBitConverter.ReadFloat (array);
}
public Serialize (data: number[]) {
MuBitConverter.WriteFloat (data, this.Spring);
MuBitConverter.WriteFloat (data, this.Damper);
MuBitConverter.WriteFloat (data, this.TargetPosition);
}
}
// ===VanillaJS===
class MuSpring {
public Spring: number;
public Damper: number;
public TargetPosition: number;
constructor (array: IMuBinary) {
this.Spring = MuBitConverter.ReadFloat (array);
this.Damper = MuBitConverter.ReadFloat (array);
this.TargetPosition = MuBitConverter.ReadFloat (array);
}
public Serialize (data: number[]) {
MuBitConverter.WriteFloat (data, this.Spring);
MuBitConverter.WriteFloat (data, this.Damper);
MuBitConverter.WriteFloat (data, this.TargetPosition);
}
}