Phonon Framework

Phonon

Events

This module is included in phonon-core.js.

RequireJS Compatible

require(['phonon-core'], function(phonon)) {
    phonon.onReady(function() {...});
});

Tap

Phonon has its own tap event that is compatible both on browser and touch enabled devices.

document.querySelector('.element').on('tap', handler);

onReady

There is a global onReady event that is called when Phonon is ready.

phonon.onReady(function() {

});

On

The on function is a shortcut for addEventListener.

document.querySelector('.element').on('click', handler);
document.querySelector('.element').on('tap', handler);

It also works with a NodeList.

document.querySelectorAll('.elements').on('tap', handler);

Off

The off function is a shortcut for removeEventListener.

document.querySelector('.element').off('click', handler);
document.querySelector('.element').off('tap', handler);

It also works with a NodeList.

document.querySelectorAll('.elements').off('tap', handler);

Global Page Event when created

document.on('pagecreated', function(evt) {
    console.log(evt.detail.page + ' is opened for the first time (created)');
});

Global Page Event when opened

document.on('pageopened', function(evt) {
    console.log(evt.detail.page + ' is opened');
});

AnimationEnd

Returns the functional event working with the browser/WebView.

phonon.event.animationEnd; // example: webkitAnimationEnd

TransitionEnd

Returns the functional event working with the the browser/WebView.

phonon.event.transitionEnd; // example: webkitTransitionEnd