- Joined
- Jan 2, 2020
- Messages
- 1,414
Here's an example how to take HTML5 arguments when compiling for the HTML5 platform.
Compile and add anything to the url e.g. #test=1&sometimportantparameter=thatneedstogetcommunicated!
Compile and add anything to the url e.g. #test=1&sometimportantparameter=thatneedstogetcommunicated!
Cerberus:
Strict
Import mojo2
#If TARGET<>"html5"
Import os
#Else
Extern
Global _hash:String = "(window.location.hash || ~q~q)"
Public
#End
Function Main%()
New Test
Return 0
End
Class Test Extends App
Field canvas:Canvas
Method OnCreate%()
SetUpdateRate 0
canvas = New Canvas
Return 0
End
Method OnRender%()
canvas.Clear
canvas.DrawText AppArgs(),10,10
' "Try add To the url #test=1&sometimportantparameter=thatneedstogetcommunicated!"
canvas.Flush
Return 0
End
Method AppArgs:String[]()
Local hash:String = _hash[1..]
Local args:String[]
If hash.Length() > 0 Then args = hash.Split("&")
Return args
End
End