aboutsummaryrefslogtreecommitdiff
path: root/doc/ref/javascript/binders.texi
blob: 0e38411bf303fb6046d5c84714a881c8d3136cc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

@node binders
@cindex binder
@cindex binders
@subsection binders.js

The bind system allows HTML-elements to specify that they want to be
updated whenever its corresponding (vcalendar) object changes.
The bind system is currently set up in
@code{bind_properties} (@pxref{bind_properties})
(which at the time of writing is (badly) located in @ref{script}).

All (HTML) components with the class @code{bind} are bound. By default
the (HTML) attribute @code{data-property} is checked for a property
name, and @code{object.innerHTML} is set whenever that property field
changes.
Alternatively an (HTML) component may specify a specific binder
through the HTML attribute @code{data-bindby}, which should be the
name of a JavaScript function taking two arguments, an @TODO{event
component}
@footnote{Root ``root'' HTML component of a given calendar event
(something which @code{get_property} can be called on},
and the component in question.

@c Also sets up event listeners, which most doesn't do.

Binder functions are generally placed in @file{binders.js}, and
shouldn't be called manually.

@defun bind_recur el e
Handles recurrence rules.
Uses a sub-binder system on components with class containing
``bind-rr''.
@end defun

@defun bind_edit el e
Cases for @code{input} and @code{textarea} elements @TODO{(should also
handle @code{select}s?)}
@end defun

@defun bind_view el e
The same as the default binder????
@end defun

@defun bind_wholeday el e
Binder for the wholeday toggle button.
While CSS would suffice, this sets the disabled flags on the time
inputs, giving a better user experience.
@end defun

@defun bind_date_time el e
@anchor{bind_date_time}
For @code{date_time} dummy component. Propagates gets and sets to
underlying input fields.

Note: @emph{Must} be called @emph{after} @code{init_date_time}.
@end defun