100 likes | 258 Views
Wave Actionscript API (wave-as-client). Sung Wu 2009/06/07. Agenda. Intro Architecture API Code example. A Flex library for accessing Google Wave Gadget API AS3 Opensource. http://code.google.com/p/wave-as-client. Introduction. Architecture. Browser. Wave Gadget. Your swf.
E N D
Wave Actionscript API(wave-as-client) Sung Wu 2009/06/07
Agenda • Intro • Architecture • API • Code example
A Flex library for accessing Google Wave Gadget API AS3 Opensource http://code.google.com/p/wave-as-client Introduction
Architecture Browser Wave Gadget Your swf ExternalInterface.call Wave-as-client library Wave Gadget Javascript API callback
Wave Actionscript Gadget API • Wave • getParticipants() • getViewer() • getHost() • getState() • getTime() • setParticipantCallback() • setStateCallback() • isInWaveContainer() • isPlayback() • WaveState • getKeys() • getStringValue(key, opt_default) • submitDelta(delta) • WaveParticipant • getId() • getDisplayName() • getThumbnailUrl() • This diagram is inspired by diagram in Google I/O presentation: • http://code.google.com/events/io/sessions/ProgrammingWithAndForGoogleWave.html
Design Decisions • Uses wave’s gadget javascript API • For state callback and participant callback, do ExternalInterface.registerCallback() • Assumes that there is only one state at a time to make things simple
Code sample: state callback private function init():void { // remember that you can only create // one instance of Wave in the application. var wave = new Wave(); wave.setStateCallback(stateCallback);}/** * @param state - WaveState object */private function stateCallback(state:Object):void { // you can use wave.getState() to get current state. Alert.show("stateCallback being called.");}
Code Sample: changeState // submit a key-vlaue pair of <"testkey", time>var delta:Object = {};delta.testkey = new Date().getTime();wave.getState().submitDelta(delta);// you should get stateCallback after you submitDelta.
Resource • Project site: http://code.google.com/p/wave-as-cleint • Blog: http://nextgenapp.blogspot.com • Contact: Sung Wu apiswswsw@gmail.com
Status • 2009/06/07: Most of the major functionalities are working. It is tested on Wave developer sandbox.