NAME
RPC::ExtDirect::API - Remoting API generator for Ext.Direct
SYNOPSIS
use RPC::ExtDirect::API namespace => 'myApp',
router_path => '/router',
poll_path => '/events',
remoting_var => 'Ext.app.REMOTING_API',
polling_var => 'Ext.app.POLLING_API',
auto_connect => 0,
no_polling => 0,
;
DESCRIPTION
This module provides Ext.Direct API code generation.
In order for Ext.Direct client code to know about what Actions (classes) and Methods are available on the server side, these should be defined in a chunk of JavaScript code that gets requested from the client at startup time. It is usually included in index.html after main ExtJS code:
<script type="text/javascript" src="extjs/ext-debug.js"></script>
<script type="text/javascript" src="myapp.js"></script>
<script type="text/javascript" src="/extdirect_api"></script>
RPC::ExtDirect::API provides a way to configure Ext.Direct definition variable(s) to accomodate specific application needs. To do so, pass configuration options to the module when you 'use' it, like shown above.
The following configuration options are supported:
namespace - Declares the namespace your Actions will
live in. To call the Methods on client side,
you will have to qualify them with namespace:
namespace.Action.Method, e.g.: myApp.Foo.Bar
router_path - URI for Ext.Direct Router calls. For CGI
implementation, this should be the name of
CGI script that provides API; for more
sophisticated environments it is an anchor
for specified PATH_INFO.
poll_path - URI for Ext.Direct Event provider calls.
Client side will poll this URI periodically,
hence the name.
remoting_var - By default, Ext.Direct Configuration for
remoting (forward) Methods is stored in
Ext.app.REMOTING_API variable. If for any
reason you would like to change that, do this
by setting remoting_var.
polling_var - By default, Ext.Direct does not provide a
standard name for Event providers to be
advertised in. For similarity, POLLING_API
name is used to declare Event provider so
it can be used on client side without
having to hardcode any URIs explicitly.
POLLING_API configuration will only be
advertised to client side if there are any
Event provider Methods declared.
no_polling - Explicitly declare that no Event providers
are supported by server side. This results
in POLLING_API configuration being suppressed
even if there are any Methods with declared
pollHandler ExtDirect attribute.
auto_connect - Generate the code that adds Remoting and
Polling providers on the client side without
having to do this manually.
SUBROUTINES/METHODS
There are no methods intended for external use in this module.
AUTHOR
Alexander Tokarev <tokarev@cpan.org>
COPYRIGHT AND LICENSE
Copyright (c) 2011 Alexander Tokarev.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.