The remoting service
We will now add our remoting service. This remoting service will provide clients with the following two methods:
getList
: This method will return the list of animals.addAnimal
: This method will take a name and a number to create an animal and add it to the list of animals in the zoo.
In order to provide this service, we will simply create a class named Service
and implement the preceding two functions in it.
The getList function
The getList
function will simply return the list from the Zoo
class:
public static function getList() : List<Animal> { returnZoo.animals; }
Ok, this one was pretty simple in our case.
The createAnimal function
The addAnimal
method will create an instance of animal setting its name and number fields with the ...
Get haXe 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.