Documentation
Connectors
At this point you already know what happens when new content arrives. The question now is « How does Kaiten know where to find it?!»
Content is wild
Content links to other contents and not always of the same origin.
For example you google about your favorite writer and you land on a Wikipedia article about him or her. Then from this same page you go to his/her personal website and from there to his/her Twitter account.
While Kaiten could simply intercepts all those links and put them inside an iframe, you might want or need to do something with the content before it is returned.
Connectors to the rescue
Before you run Kaiten you need to inform it about the different types of content you want to manage. This is done thanks to the connectors.
Each time Kaiten catches a link (or anything else meaning 'call for content') it runs through all its connectors. Each connector says «Yes this is mine to deal with» or «No, I don't know this». If Kaiten has found a connector it executes it else it falls back to a default connector.
Please also note that Kaiten comes with embedded basic connectors:
- "html.string", for setting "static" HTML content.
- "html.page", for getting HTML content from the server.
- "html.dom", for loading content from a (set of) DOM elements.
- "iframe", for loading external URLs in an iframe.
More about connectors
A connector is a JavaScript object that has at least three methods in it :
-
Connector.connectable()
Returns true or false if it can deal with the call or not -
Connector.getData()
Returns the data that are necessary to handle the call. They will be given to Connector.loader() -
Connector.loader()
Manages the call and returns the content.
We provide various implementations examples ranging from the classic "Hello World!" to more complex connectors like the one we made to deal with Wikipedia data.