As you are exposing the
async api - all appAPI calls that you are doing should have a callback.
So every API method without a callback - simply add the first parameter as a callback function, the one that has a callback function stays the same.
So for example, the appAPI.db.get you are doing, should look like this:
appAPI.db.get(function(data) {
// your code here
}, "test"));
appAPI.db.set(function() {
// do something else
}, "db_key_name", db_value);
Exposing the appAPI to an iFrame
You can also expose the appAPI to an iframe with a src of your trusted domain. This is very useful when you need to include a sidebar to each page with content from your own website and want to use the appAPI object from that page.
There is a small addition you will have to make in your code inorder for this to work on Chrome as well. (In Firefox and IE it works seamlessly)
First, you will need to give a unique ID to your iframe, for example:
Second, you will need to add the following code to your app code:
if (appAPI.platform == "CH") appAPI.asyncAPI.setTargetIframe("my_iframe_id");
This will make sure that Chrome will know which iframe on the page did the request and where it should send the callbacks to.
Please see this: <a href="http://getsatisfaction.com/crossrider/topics/need_to_access_appapi_functions_from_web_pages_i_doesnt_own">http://getsatisfaction.com/crossrider/topics/need_to_access_appapi_functions_from_web_pages_i_doesnt_own</a>
Please see this thread:
https://getsatisfaction.com/crossrider/topics/appapi_installer_getparams_in_exposed_appapi