httprequest_test.monkey2 835 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Namespace myapp
  2. #Import "<std>"
  3. #Import "<mojo>"
  4. #Import "<httprequest>"
  5. Using std..
  6. Using mojo..
  7. Using httprequest..
  8. Class MyWindow Extends Window
  9. Field req:HttpRequest
  10. Method New( title:String="HttpRequest demo",width:Int=640,height:Int=480,flags:WindowFlags=Null )
  11. Super.New( title,width,height,flags )
  12. req=New HttpRequest( "GET","http://www.blitzbasic.com",Lambda()
  13. Print "Ready state changed to "+Int( req.ReadyState )
  14. If req.ReadyState=4
  15. Print "ReponseText="+req.ResponseText
  16. Print "Status="+req.Status
  17. Endif
  18. End )
  19. New Fiber( Lambda()
  20. req.Send()
  21. End )
  22. End
  23. Method OnRender( canvas:Canvas ) Override
  24. App.RequestRender()
  25. canvas.DrawText( "Hello World!",Width/2,Height/2,.5,.5 )
  26. End
  27. End
  28. Function Main()
  29. New AppInstance
  30. New MyWindow
  31. App.Run()
  32. End