Defining objects when using Jaxer

前端 未结 1 1533
灰色年华
灰色年华 2020-12-18 15:12

I\'ve been playing with Jaxer and while the concept is very cool I cannot figure out how to define objects that are available on both the client and the server. None of the

1条回答
  •  攒了一身酷
    2020-12-18 15:24

    I found a post on the Aptana forums (that no longer exists on the web) that states that only global functions can be proxied... Bummer.

    However, I've been playing around, and you can control which methods will be available on the client and the server by placing your code in an include file and using

    And I can include it on a page using:

    
    

    Unfortunately with this method I lose the advantage of browser caching for client-side scripts because all the scripts get inlined. The only technique I can find to avoid that problem is to split the client methods, server methods and shared methods into their own js files:

    
    
    
    

    And, at that point I might as well split the proxied functions out into their own file as well...

    
    

    Note that I used autoload="true" on the shared and server scripts so that they would be available to the proxied functions.

    0 讨论(0)
提交回复
热议问题