-
Notifications
You must be signed in to change notification settings - Fork 11
/
WatchedClass.hx
33 lines (21 loc) · 1.06 KB
/
WatchedClass.hx
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
package sample.interpretable;
import interpret.Interpretable;
class WatchedClass implements Interpretable {
public function new() {
} //new
/** This is a native (non-interpreted) method. Modifying it when the app is running
will have no effect on the running code. */
public function getClassNameFromNative():String {
return Type.getClassName(Type.getClass(this));
} //getClassNameFromNative
/** This is an interpretable method. It is compiled as native haxe code with the app,
but if the method is updated while the app is running, its new content will be live-reloaded
and the code will be executed with `interpret`. */
@interpret public function printSomething() {
// Just testing calling a native (non-interpreted) method
// and get its return value
var className = getClassNameFromNative();
// Then printing something (note that string interpolation works :))
trace('Just printing something from $className.printSomething()');
} //printSomething
} //WatchedClass