Skip to content

Commit a58c5b4

Browse files
authored
Merge pull request #15 from elnabo/title-support
Title compatiblity
2 parents c51eb80 + 7c6cb42 commit a58c5b4

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

haxe/ui/backend/ScreenBase.hx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,25 @@ class ScreenBase {
4141
return value;
4242
}
4343

44+
public var title(get,set):String;
45+
private inline function get_title():String {
46+
#if js
47+
return js.Browser.document.title;
48+
#else
49+
trace("WARNING: this platform doesnt support dynamic titles");
50+
return "";
51+
#end
52+
}
53+
private inline function set_title(s:String):String {
54+
#if js
55+
js.Browser.document.title = s;
56+
return s;
57+
#else
58+
trace("WARNING: this platform doesnt support dynamic titles");
59+
return "";
60+
#end
61+
}
62+
4463
private var _topLevelComponents:Array<Component> = new Array<Component>();
4564
public function addComponent(component:Component) {
4665
_topLevelComponents.push(component);
@@ -165,4 +184,4 @@ class ScreenBase {
165184
mouseEvent.screenY = y / Toolkit.scaleY;
166185
_mapping.get(MouseEvent.MOUSE_UP)(mouseEvent);
167186
}
168-
}
187+
}

0 commit comments

Comments
 (0)