Event Listeners

Start again from scratch

With our new CMS, we are starting again from scratch. We started off last time in web-ui-intro by introducing evl.js. We replaced it with just a few utility functions. We also broke up our cms.js into a few files. So we will introduce those first, then our new event listener programming followed by example usage. It will all be much the same as web-ui-intro except written more concisely and organized more neatly.

mknode()

All the code the makes dom nodes was organized in it's own file. We added functions for creating buttons and inputs of type text and number.

mknode() src code file link

mknode.js

mknode() src code screenshot

source code of mknode()

domUtil{}

All the code the DOM manipulation functions were added to their own file. We added functions and prototypes for event programming. This replaces the evl.js we used before.

domUtil{} src code file link

domUtil.js

domUtil{} src code screenshot

source code of domUtil{}

cms{}

All the code the CMS code it it's own file. Nothing changed.

cms{} src code file link

cms.js

cms{} src code screenshot

source code of cms{}

event-listeners

Our new program event-listeners.js demonstrate creating a button and an input and configuring the event listener routines.

event-listeners{} src code file link

event-listeners.js

event-listeners{} src code screenshot

source code of event-listeners{}

Demo page

Look for the button and input on the bottom left of the page after the footer. Open the console to note the callbacks are working.

demo