Please feel free to add to these pages! The documentation is a wiki, and anyone can sign up. Note that all modifications will be moderated by the development team.
Introduction to JSAPI
FB::JSAPI class. Most JSAPI objects derive from the
FB::JSAPIAuto helper class.
JSAPI objects are named by convention with the suffix "API". The
fbgen tool creates the root JSAPI object named the same as your plugin object with the API suffix appended. e.g. for the plugin object "MyPlugin", the JSAPI object is commonly named "MyPluginAPI".
If your object tag looks like this:
Your plugin resides then in the object tag with
Methods, Properties, Attributes, and Events
- Properties - Properties are accessed like a member variable, but they have a getter and optionally a setter in your JSAPI class. Properties with only a getter are read-only and will throw an exception if you try to assign to them.
- Events - Events work similarly to normal DOM events such as "onload", or "onmousemove". They originate from a JSAPI object and make callbacks into the page. Following standard conventions, events are registered using
attachEventin IE and
addEventListenerin all other browsers.
Once you have a basic understanding of how these interfaces work, you will also want to read up on the types that are supported by JSAPIAuto.