diff options
| author | RblSb <msrblsb@gmail.com> | 2021-06-06 21:50:14 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2021-06-06 21:50:14 +0300 |
| commit | 265b3e1fb56bb0e5f797b3b35227a616b108a0c3 (patch) | |
| tree | ad3fbf3bfddeca1c51813f6667f0181a69dfe4fe /src/client/Main.hx | |
| parent | 13127249ddd1f61f8ed6b75803b0de1f4d25f96e (diff) | |
More JsApi methods
getVideoItems/addVideoItem/removeVideoItem
closes #24
Diffstat (limited to 'src/client/Main.hx')
| -rw-r--r-- | src/client/Main.hx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx index b9c9892..1d9ac34 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -242,7 +242,7 @@ class Main { addVideo(link, atEnd, isTemp, () -> addVideoArray(links, atEnd, isTemp)); } - function addVideo(url:String, atEnd:Bool, isTemp:Bool, callback:()->Void):Void { + public function addVideo(url:String, atEnd:Bool, isTemp:Bool, ?callback:()->Void):Void { final protocol = Browser.location.protocol; if (url.startsWith("/")) { final host = Browser.location.hostname; @@ -275,7 +275,7 @@ class Main { }, atEnd: atEnd }}); - callback(); + if (callback != null) callback(); }); } @@ -316,6 +316,14 @@ class Main { }); } + public function removeVideoItem(url:String) { + send({ + type: RemoveVideo, removeVideo: { + url: url + } + }); + } + public function toggleVideoElement():Bool { if (player.hasVideo()) player.removeVideo(); else if (!player.isListEmpty()) { |
