Your SlideShare is downloading. ×
0
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
GvaScript Library
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

GvaScript Library

903

Published on

yet another javascript widgets library

yet another javascript widgets library

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
903
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Mona Remlawi (mona.remlawi@gmail.com) Perl.it Workshop - October 2009
  • 2. <ul><li>pronounced as “gee-vascript“ </li></ul><ul><li>javascript library born in Geneva, Switzerland </li></ul>
  • 3. <ul><li>Current Version 1.17 </li></ul><ul><li>CPAN </li></ul><ul><li>http://search.cpan.org/dist/Alien-GvaScript/lib/Alien/GvaScript.pm </li></ul><ul><li>GoogleCode </li></ul><ul><li>http://code.google.com/p/gvascript/ </li></ul>
  • 4.  
  • 5. core extends prototype framework fills in the blanks where prototype left off
  • 6. <ul><li>events delegation </li></ul><ul><li>binds a handler to an event for elements matching a selector </li></ul><ul><li>Event.register & Event.unregister </li></ul><ul><li>Element#register & Element#unregister </li></ul><ul><li>document.register & document.unregister </li></ul>
  • 7. <ul><li>keyboard events handling </li></ul><ul><li>GvaScript.KeyMap class </li></ul><ul><li>binds a handler to a sequence of keys for a given element/document </li></ul>
  • 8. <ul><li>JSONP support </li></ul><ul><li>Prototype.getJSON(url, callback) </li></ul><ul><li>loads a JSON from a remote URL </li></ul><ul><li>when ready -> callback(json_data) </li></ul>
  • 9. <ul><li>misc extensions </li></ul><ul><li>Hash.expand </li></ul><ul><li>Hash.flatten </li></ul><ul><li>String.chomp </li></ul><ul><li>Element.autoScroll </li></ul><ul><li>Element.flash </li></ul><ul><li>Element.outerHTML </li></ul><ul><li>Event.detailedStop </li></ul><ul><li>RegEx.escape </li></ul><ul><li>Class.checkOption </li></ul>
  • 10.  
  • 11. <ul><li>4 different types for datasource </li></ul><ul><ul><li>Static list </li></ul></ul><ul><ul><li>Function </li></ul></ul><ul><ul><li>Ajax </li></ul></ul><ul><ul><li>JSONP </li></ul></ul>
  • 12. <ul><li>tons of options </li></ul><ul><ul><li>autoSuggest / autosuggestDelay </li></ul></ul><ul><ul><li>minimumChars </li></ul></ul><ul><ul><li>typeAhead </li></ul></ul><ul><ul><li>strict / blankOK </li></ul></ul><ul><ul><li>caseSensitive </li></ul></ul><ul><ul><li>ignorePrefix </li></ul></ul><ul><ul><li>multivalued </li></ul></ul><ul><ul><li>minWidth / maxHeight / offsetX </li></ul></ul><ul><ul><li>… </li></ul></ul>
  • 13. <ul><li>callbacks </li></ul><ul><ul><li>onBind </li></ul></ul><ul><ul><li>onLegalValue </li></ul></ul><ul><ul><li>onIllegalValue </li></ul></ul><ul><ul><li>onLeave </li></ul></ul>
  • 14. <ul><li>easy mapping of dependent fields </li></ul><ul><ul><li>options.dependentFields = {src: target[, ]} </li></ul></ul><ul><ul><li><input ac:dependentFields=“{src: target[, ]}” /> </li></ul></ul>=> DEMO
  • 15. <ul><li>Easy keyboard navigation </li></ul><ul><ul><li>Arrows keys </li></ul></ul><ul><ul><li>Tab / Shift-Tab </li></ul></ul><ul><ul><li>Find as you type </li></ul></ul><ul><ul><li>+ & - to open & close </li></ul></ul><ul><ul><li>* & / to explode & fold </li></ul></ul><ul><ul><li>… </li></ul></ul><ul><li>Support node lazy loading </li></ul><ul><li>Support node HTML content </li></ul>
  • 16. <ul><li>callbacks </li></ul><ul><ul><li>onOpen / onClose </li></ul></ul><ul><ul><li>onSelect / onDeselect </li></ul></ul><ul><ul><li>onBeforeLoadContent / onAfterLoadContent </li></ul></ul><ul><ul><li>onPing </li></ul></ul>=> DEMO
  • 17. <ul><li>Neat rendering of buttons (CSS) </li></ul><ul><li>Hover / Focus styling </li></ul><ul><li>Easy navigation with keys </li></ul><ul><ul><li>Tab / Shift-Tab </li></ul></ul><ul><ul><li>Right / Left arrows </li></ul></ul><ul><li>Can have a type </li></ul><ul><ul><li>submit </li></ul></ul><ul><ul><li>reset </li></ul></ul><ul><li>Or an explicit callback </li></ul>=> DEMO
  • 18. <ul><li>JSON datasource </li></ul><ul><li>Paginated </li></ul><ul><li>Easy navigation with keys </li></ul><ul><ul><li>Up / Down arrows </li></ul></ul><ul><ul><li>Home / End </li></ul></ul><ul><ul><li>Right / Left arrows </li></ul></ul><ul><ul><li>PageUp / PageDn </li></ul></ul><ul><ul><li>Ctrl-Home / Ctrl-End </li></ul></ul><ul><li>Easy inclusion of CustomButtons </li></ul>
  • 19. <ul><li>callbacks </li></ul><ul><ul><li>onShow </li></ul></ul><ul><ul><li>onPing </li></ul></ul><ul><ul><li>onEmpty </li></ul></ul><ul><ul><li>onCancel </li></ul></ul>=> DEMO
  • 20. <ul><li>JSON datasource </li></ul><ul><li>Helpers to serialize/de-serialize form data </li></ul><ul><ul><li>GvaScript.Form#fill_from_tree </li></ul></ul><ul><ul><li>GvaScript.Form#to_hash </li></ul></ul><ul><ul><li>GvaScript.Form#to_tree </li></ul></ul><ul><li>Easy inclusion of custom buttons </li></ul>
  • 21. <ul><li>Support for repeatable sections </li></ul>GvaScript.Form.add('authors') GvaScript.Form.remove('authors.1')
  • 22. <ul><li>Uses event delegation to register events on the form level </li></ul><ul><li>Supports all W3C standard events </li></ul><ul><ul><li>click, mouseover, mouseout, focus, blur, change … </li></ul></ul><ul><li>Supports a custom event ‘init’ on form controls </li></ul><ul><li>‘ init’ gets fired when a control gets initialized with GvaScript.Form#init </li></ul>
  • 23. <ul><li>Handlers will receive </li></ul><ul><ul><li>event object </li></ul></ul><ul><ul><li>newvalue (change & init) </li></ul></ul><ul><ul><li>oldvalue (change) </li></ul></ul>
  • 24. <ul><li>callbacks </li></ul><ul><ul><li>onInit </li></ul></ul><ul><ul><li>onChange </li></ul></ul><ul><ul><li>onBeforeSubmit </li></ul></ul><ul><ul><li>onSubmit </li></ul></ul><ul><ul><li>onBeforeDestroy </li></ul></ul>
  • 25. new GvaScript.Form(...) onInit form.submit() onBeforeSubmit ? onSubmit onChange control change [return false] onBeforeDestroy form.destroy()
  • 26. <ul><li>Use fire method to fire custom events </li></ul><ul><li>GvaScript.Form#fire(‘XYZ’, arg) </li></ul><ul><ul><li>calls onXYZ callback if any </li></ul></ul><ul><ul><li>passes instance as a first argument </li></ul></ul><ul><ul><li>arg goes second </li></ul></ul>
  • 27. <ul><li>Global Responders </li></ul><ul><li>Applicable to all GvaScript.Form instances </li></ul><ul><li>Execute *after* instance callback </li></ul>
  • 28. <ul><li>Global Responders </li></ul><ul><li>Applicable to all GvaScript.Form instances </li></ul><ul><li>Execute *before* instance callback </li></ul>
  • 29. form.fire('XYZ'[, arg]) EarlyResponders Responders callback Execution chain will stop whenever *any* of the responders or instance callback returns *false*
  • 30. <ul><li>Global Responders can be used to </li></ul><ul><ul><li>Define global behavior of forms </li></ul></ul><ul><ul><li>Plugin form validation </li></ul></ul><ul><ul><li>Plugin form control masking </li></ul></ul><ul><ul><li>… </li></ul></ul>=> DEMO
  • 31.  
  • 32. <ul><li>i18n </li></ul><ul><li>Use GvaScript.KeyMap to extend DOM elements with </li></ul><ul><ul><li>Element#keyListen(keyRegex, handler) </li></ul></ul><ul><ul><li>Element#stopKeyListening(keyRegex[, handler]) </li></ul></ul><ul><li>You tell me ... </li></ul>
  • 33. Thanks !! Questions ??

×