Hi everyone,
This is a long email so I hope you'll bear with me! If you code ajax
applications or have an interest in learning, it'd be great to get your
feedback on my questions/ideas/assumptions below for a tutorial I'm working
on.
1) Assumption: you're primarily using javascript to build an event-based
system, where in response to clicking links or submitting forms, the
javascript code carries out an action and possibly modifies the page based
on the results
2) Assumption: developers commonly create separate event listeners and
functions for each action using javascript framework-specific code, rather
than coding a javascript layer between your app and the framework code
3) Coding your own event registering function, handling events under one
main listener, and even abstracting away the already reduced framework code
for XHR calls, is a good way to reduce event listeners and keep the
application scalable/maintainable. Below is some theoretical code to show
how you might register events that will operate under a single event
listener and could be backed by any 3rd party javascript
frameworks/plugins/widgets/etc.
// when someone clicks aLink, your application fills the html results into
the element with the id "content"
MyApp.register( { url : aLink, responseType : 'HTML', fillElement :
'content' } );
// custom function someFunction handles a JSON response from the server when
a link matching linkPattern is clicked
MyApp.register( { url : linkPattern, responseType : 'JSON', handler :
someFunction } );
// on submit of form id formID, function makeDateWidget handles the html
response and runs code to load a date picker
MyApp.register( { form: 'formID', responseType : 'HTML', handler :
makeDateWidget } );
4) The missing parts here (how the register function works and how the
pyramid code supports it) would be the focus of the tutorial, so is this
what people are looking for in an ajax + pyramid tutorial? What other
goals/questions/issues are out there?
Thanks!
Eric
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.