In file1.js I read:
// NOTE: initialize your app event handlers here, see file2.js for a simple event handler example
// TODO: configure following to work with both touch and click events (mouse + touch)
// see http://msopentech.com/blog/2013/09/16/add-pinch-pointer-events-apache-cordova-phonegap-app/
//...overly simple example...
// var el, evt ;
//
// if( navigator.msPointerEnabled || !('ontouchend' in window)) // if on Win 8 machine or no touch
// evt = "click" ; // let touch become a click event
// else // else, assume touch events available
// evt = "touchend" ; // not optimum, but works
//
// el = document.getElementById("id_btnHello") ;
// el.addEventListener(evt, myEventHandler, false) ;
in file2.js I read:
// This file contains your event handlers, the center of your application.
// NOTE: see file1.js for event handler initialization code.
// example event handler
function myEventHandler() {
// event handler code
};
What "initialize event handlers here
" in file1.js is supposed to mean?
What should I do there?
Is it a place for defining additional event handlers, like the one in file2.js ?
Or could it be that by "initialize
" they mean that file1.js is the place where I should make use of an even handler (i.e. using it within an event listener, like in the example that comes after, in file1.js) ?
I've googled the expression "event handler initialization", or "initialize event handler" and I found almost nothing, so I am confused...
Update: In code above, in file2.js, I had forgotten to include the beginning comments. Added them. Hopefully this can help further understand the different roles of the two files?