-
Notifications
You must be signed in to change notification settings - Fork 101
Use baker javascript events
Baker supports some javascript events that are triggered when the page gets visualized on the screen and goes away, and when the user clicked on a URL that could not be handled.
The focus
event is fired when the page gets visualized on the screen. It's useful to trigger animations and event exactly when the user starts looking at the page.
The event behaves like the standard window focus
function in standard browsers.
window.addEventListener("focus", function() { ... }, true);
The blur
event is fired when the page goes off-screen and is not visible anymore. It's useful to disable animations, sounds and videos that might be playing in the background at the right moment.
The event behaves like the standard window blur
function in standard browsers.
window.addEventListener("blur", function() { ... }, true);
It's possible to send messages to other installed iOS applications by crafting a special URL. For example, clicking the following link will open the Twitter app:
<a href="twitter://post?message=hello%20world">Share On Twitter</a>
The urlnothandled
event is fired when such a link is clicked and the corresponding app is not installed on the device. The event has a url
parameter.
window.addEventListener("urlnothandled", function(event) { alert(event.url) });
Since Baker 4.2
Whenever the info.html
page is loaded in the Info box, an init
event is generated inside the page to pass in the current user_id
and app_id
(see Baker Server API for a description of the parameters).
The following example listens to the event and creates an alert popup with the values of the parameters.
window.addEventListener("init", function(event) { alert(event.user_id + " " + event.app_id) });