RemotingApi.hx 611 B

1234567891011121314151617181920212223242526272829303132333435
  1. package unit;
  2. class RemotingApi #if swf_mark implements mt.Protect #end {
  3. var sub : RemotingApi;
  4. public function new() {
  5. sub = this;
  6. }
  7. public function add(x : Int,y : Int) {
  8. return x + y;
  9. }
  10. public function id( str : String ) {
  11. return str;
  12. }
  13. public function arr( a : Array<String> ) {
  14. return a.join("#");
  15. }
  16. public function exc( v : Dynamic ) {
  17. if( v != null )
  18. throw v;
  19. }
  20. public static function context( ?ctx ) {
  21. if( ctx == null ) ctx = new haxe.remoting.Context();
  22. ctx.addObject("api",new RemotingApi());
  23. ctx.addObject("apirec",new RemotingApi(),true);
  24. return ctx;
  25. }
  26. }