瀏覽代碼

Added low budget OpenUrl for emscripten - it just replaces the app page with the given url so effectively ends app! Not sure if it's even possible to open a new window from js. I get pop up warnings from the browser when I try with window.open().

Mark Sibly 7 年之前
父節點
當前提交
6fcdfbb7ba
共有 3 個文件被更改,包括 13 次插入1 次删除
  1. 1 1
      modules/std/module.json
  2. 8 0
      modules/std/requesters/requesters.monkey2
  3. 4 0
      modules/std/std.monkey2

+ 1 - 1
modules/std/module.json

@@ -4,5 +4,5 @@
 	"author":"Mark Sibly",
 	"author":"Mark Sibly",
 	"version":"1.0.0",
 	"version":"1.0.0",
 	"support":"http://monkeycoder.co.nz",
 	"support":"http://monkeycoder.co.nz",
-	"depends":["libc","jni","sdl2","miniz","stb-image","stb-image-write","stb-vorbis","zlib"]
+	"depends":["libc","emscripten","jni","sdl2","miniz","stb-image","stb-image-write","stb-vorbis","zlib"]
 }
 }

+ 8 - 0
modules/std/requesters/requesters.monkey2

@@ -121,4 +121,12 @@ Function OpenUrl( url:String )="bbRequesters::OpenUrl"
 	
 	
 Public
 Public
 
 
+#Elseif __TARGET__="emscripten"
+
+Function OpenUrl( url:String )
+	
+	emscripten.emscripten_run_script( "window.location.href='"+url+"'" )
+	
+End
+
 #Endif
 #Endif

+ 4 - 0
modules/std/std.monkey2

@@ -15,6 +15,10 @@ Namespace std
 #Endif
 #Endif
 #Endif
 #Endif
 
 
+#If __WEB_TARGET__
+#Import "<emscripten>"
+#endif
+
 #Import "collections/container"
 #Import "collections/container"
 #Import "collections/stack"
 #Import "collections/stack"
 #Import "collections/list"
 #Import "collections/list"