Prev | Current Page 815 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The fillList() function iterates over the received array and builds an HTML list of
elements. Each element is enhanced with an onclick event that once triggered uses the db object to
load all the data about the selected person. Parents and children are also active links to refresh the
page content.
import js.Dom;
import Person;
class PersonDatabaseProxy extends haxe.remoting.AsyncProxy < PersonDatabase > {}
class Client
{
public static function main()
{
new Client(???http://localhost:2000/server.n???);
}
public function new(url)
{
var cnx = haxe.remoting.AsyncConnection.urlConnect(url);
cnx.onError = function(e) {
trace(???Error: ??? +Std.string(e));
}
db = new PersonDatabaseProxy(cnx.PersonDatabase);
db.listIds(fillList);
}
private var db : PersonDatabaseProxy;
private function fillList(ids : Array < PersonId > )
{
var ul = js.Lib.document.getElementById(???persons???);
ul.innerHTML = ?????™;
for(id in ids)
Chapter 15: Putting It All Together with haXe Remoting
441
{
var li = js.Lib.


Pages:
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827