Skip to content

pisi/The

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"The" Event

DOM data change announcement event for jQuery

Usage of .the is identical to jQuery's own .data function

  • it stores/retrieves data key values from data set stored on DOM node. On top of it has two unique feature add-ons described below.

Value Change Event

Each verified value change is announced with "the" event. Along with the standard event object, the callback receives key and value.

Normalization of Values

Sometimes you want to make sure a to-be-stored value is "legal" by checking the value against a normalization method. An optional third parameter can be supplied when setting a value. The parameter will be hash of normalization functions per key (if any). Normalization function receives input value and must return back the normalized one. Any value first undergoes normalization and is stored after then (if changed).

.the( callback )

Binds a callback function to "the" event. Equivalent of .bind("the", callback). "the" event is triggered every time a data value changes. Its callback receives key and value as additional parameters.

Returns jQuery.

.the( key )

Retrieves the key from DOM node data store. Covenience method, equivalent of .data(key).

.the( key, value, [ normals ] )

Stores the key value into DOM node data store.


© 2011 Petr Vostrel

@license "The" Event
Copyright (c) 2011 Petr Vostrel (http://petr.vostrel.cz/)
Dual licensed under the MIT (MIT-LICENSE.txt)
and GPL (GPL-LICENSE.txt) licenses.

Version: 0.1
Updated: 2011-03-17

About

Data value change event for jQuery

Resources

Stars

Watchers

Forks

Packages

No packages published