David de Roure Mark Borkum
David de Roure Mark Borkum
David De Roure
Mark Borkum
Why?
Why?
• Where is it executed?
– Typically (but not always) within the client’s Web browser
myfunc(“hello”, “world”)
“hello, world”
Function parameters are optional
myfunc(“hello”)
“hello”
• http://prototypejs.org/api/utility
7/7/2008 ISSGC'08 - Intro to Web 2.0 mashups 24
Enumerable - JavaScript meets Ruby
• Prototype was originally developed as a library for
Ruby on Rails..
– Many classes and modules were ‘adapted’ for Prototype
• An enumeration has:
– 1..N elements
– A method for returning the ith element
• collect(iterator [, index])
– Executes the iterator as a closure
– Returns the result as an Array
• map(iterator [, index])
– Alias for collect()
7/7/2008 ISSGC'08 - Intro to Web 2.0 mashups 26
Google Maps API
• Comes in 3 flavours:
– JavaScript
– ActionScript
– REST (a.k.a. “Static Maps”)
• $A(enumerable) Array
– Converts an enumerable object to a Prototype Array
• $H(object) Hash
– Converts any object to a Prototype Hash (associative array)
• Submission Guidelines:
– Use (X)HTML, CSS, JavaScript and XML
– Comment your code (please!)
– One entry per group, mailed to
[email protected]
– Entries will be accepted until 5pm on Wednesday 17th
• Conclusions:
– Web 2.0 is using new technologies to
deliver a richer user experience.
– Google JavaScript APIs are simple!
– Malcolm likes cats!
David De Roure