|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--GLOBALS
| Method Summary | |
<static> function
|
add_event_handler(<DOM:element> obj, <String> event, <function> handler)
Adds an event handler to a DOM node without replacing any existing handlers. |
<static> void
|
addTestResult(test, success, index)
Writes the result of running a test to the DOM. |
<static> void
|
alert_on_error(source, msg)
One possible behavior on error: alert. |
<static> void
|
attach_handler(<DOM:element> obj, <function> handler)
Recursively attaches events to a DOM object. |
<static> function
|
bind_lens(<Lens> lens, <String> dom_id, <function> dom_update_callback, <int> polling)
Binds a lens to a given id in the document. |
<static> Object
|
clone(o, as_array)
Clones an object or an array (shallowly); anything else is simply returned. |
<static> Object
|
createTestInfo(test, count_id, time_id, failures_id, prose)
Creates the structure for storing test results. |
<static> void
|
debugger_on_error(source, msg)
One possible behavior on error: start a debugger with the debugger keyword. |
<static> Object
|
dom_obj(o)
|
<static> DOM:element
|
domify(o)
Turns an object into a displayable DOM element. |
<static> boolean
|
equal(o1, o2)
Recursively tests equality of objects. |
<static> DOM:element
|
get_dom_object(<String> name, <boolean> strict)
Gets a DOM object in a portable/intelligent way. |
<static> boolean
|
has_prop(o, <String> p)
Determines whether p is a property of o. |
<static> void
|
incrementTestCount(countSpan, success)
Updates a test count. |
<static> boolean
|
is_editable(o)
A predicate for DOM objects which are editable, and which events must be caught for. |
<static> boolean
|
is_lens(o)
Returns true if a given object is a lens. |
<static> Object
|
jsify(<DOM:node> e, orig)
Turns a DOM element into a JavaScript object -- as best it can. |
<static> Contract
|
lens_c(<Contract> get_c, <Contract> putback_c)
A contract for a lens object. |
<static> Contract
|
lens_constructor()
A contract for a Lens-derived lens constructor, that enforces a calling convention, as well as get and putback contracts on the generated lens. |
<static> void
|
log_on_error(source, msg)
One possible behavior on error: log the error to the Firebug console. |
<static> Object
|
make_arith_lens(<String> name, <function> op, <function> inv, <function> guard)
Generates and registers arithmetic lenses. |
<static> Object
|
make_dom_node(<String> name, attribs, <Array> children)
Creates a DOM node. |
<static> function
|
make_lens_function(<Lens> lens, <String> name)
Converts a lens constructor into a lens function. |
<static> Object
|
make_tag_lens(<String> name, <String> placement)
Makes an LTag-derived lens. |
<static> Object
|
merge_objects(<Object> o1, <Object> o2, <function> error)
Merges two objects. |
<static> Object
|
nodify(o, id)
Turns objects into span elements with ids. |
<static> void
|
nonzero_v(v, d)
The guard used in LTimes and LDivide to prevent v==0 from occuring. |
<static> void
|
recordTestTime(test, ms)
Writes the time taken running a series of tests to the DOM. |
<static> void
|
runTests()
Runs all tests in __tests. |
<static> Object
|
scrub(s)
|
<static> void
|
set_error_handler(<function> handler)
Sets the current error handler. |
<static> Object
|
split_object(<Object> o, <function> pred)
Splits an object in two: one whose properties all match a predicate, and the rest which fail. |
<static> void
|
throw_on_error(source, msg)
One possible behavior on error: throw. |
<static> thunk
|
throws_e(<function> f, <function> e_pred)
Tests that running f throws a value that satisfies e_pred. |
<static> Lens
|
unbind_lens(<String> dom_id)
Unbinds a lens bound to the DOM id dom_id. |
<static> void
|
update_lens_prototype(<String> name, <function> fun, <boolean> no_seq)
Updates the Lens prototype to have a method with the given name that calls the lens function (see make_lens_function()) fun as the second argument to an LSeq, e.g. |
| Method Detail |
<static> function add_event_handler(<DOM:element> obj, <String> event, <function> handler)
obj - The DOM node
event - The event name (e.g. 'click') or moniker (e.g., 'onclick')
handler - The handler to call; it will be passed the event object, and the 'this' object will be the DOM node on which the event occurred
<static> void addTestResult(test, success, index)
<static> void alert_on_error(source, msg)
<static> void attach_handler(<DOM:element> obj, <function> handler)
obj - The DOM object
handler - The event handler -- it will be passed the cross- browser event object
<static> function bind_lens(<Lens> lens, <String> dom_id, <function> dom_update_callback, <int> polling)
Binds a lens to a given id in the document. It returns a callback that notifies the lens binding of new model values; it takes an optional callback to notify the caller of new model values due to DOM changes.
lens - The lens
dom_id - The id to bind to
dom_update_callback - The callback to call when the DOM changes to create a new model value; it will be called with the new value
polling - An optional argument setting the frequency in milliseconds to check for new DOM structure; the default is 5000
<static> Object clone(o, as_array)
o - The value to be cloned
as_array - Set to true to force the argument to be treated as an array; the default is false
<static> Object createTestInfo(test, count_id, time_id, failures_id, prose)
<static> void debugger_on_error(source, msg)
<static> Object dom_obj(o)
<static> DOM:element domify(o)
o - The object to put into the dom
<static> boolean equal(o1, o2)
o1 - First value to compare
o2 - Second value to compare
<static> DOM:element get_dom_object(<String> name, <boolean> strict)
name - The name of the DOM object; if name is already a DOM object, then it is simply returned
strict - Set to true to cause an error for failed lookups; the default is false
<static> boolean has_prop(o, <String> p)
o - The value to test
p - The property to check for
<static> void incrementTestCount(countSpan, success)
<static> boolean is_editable(o)
o - Any object
<static> boolean is_lens(o)
o - Any object
<static> Object jsify(<DOM:node> e, orig)
e - A DOM node
<static> Contract lens_c(<Contract> get_c, <Contract> putback_c)
get_c - The contract for the get operation
putback_c - The contract for the putback operation
<static> Contract lens_constructor()
<static> void log_on_error(source, msg)
<static> Object make_arith_lens(<String> name, <function> op, <function> inv, <function> guard)
name - The lens to create
op - The operator
inv - Its inverse
guard - An optional guard over v and d, which can throw an error if v and d are somehow invalid for op and inv, e.g. would cause a divide-by-zero. Takes v, and d. For an example, see nonzero_v().
<static> Object make_dom_node(<String> name, attribs, <Array> children)
name - The element name to create
attribs - An object mapping attribute names to values
children - The list of child nodes
<static> function make_lens_function(<Lens> lens, <String> name)
lens - The lens constructor
name - The lens' name
<static> Object make_tag_lens(<String> name, <String> placement)
Makes an LTag-derived lens. Similar in spirit to make_arith_lens(). Given the name, it creates the Lens constructor LNameTag and the lens function (a la make_lens_function()) name_tag.
The generated lenses take one of three calling conventions. Using LDivTag as an example, a DIV lens can be created in the standard LTag way: new LDivTag({ id: 'foo' }, ['First child']). It may also be called with an implicit LLayout: new LDivTag({ id: 'foo' }, 'lbl1', 'Foo: ', 'foo', new LPlus(5, 0), 'lbl2', 'Bar: ', 'bar', new LId()), where the arguments to LLayout are all of those after the attribute object. The third calling convention uses an implicit LSeq, like so: new LInputTag({ id: 'num' }, plus(5, 0)), where the value after the attribute object is a lens.
Lenses with a placement of 'const' will use LConstTag, which is a DOM-aware LConst.
name - The lens to create
placement - The default value for placement in LTag; should be either 'child', 'const', or an attribute name
<static> Object merge_objects(<Object> o1, <Object> o2, <function> error)
o1 - The first object
o2 - The second object
error - Optional. Called if a property in o2 is also in o1
<static> Object nodify(o, id)
o - The object
id - The id to use
<static> void nonzero_v(v, d)
<static> void recordTestTime(test, ms)
<static> void runTests()
<static> Object scrub(s)
<static> void set_error_handler(<function> handler)
handler - An error handler: function (source, msg) { ... }
<static> Object split_object(<Object> o, <function> pred)
o - The object to split
pred - The predicate over property names
<static> void throw_on_error(source, msg)
<static> thunk throws_e(<function> f, <function> e_pred)
f - The function to run
e_pred - A predicate matching the desired exception
<static> Lens unbind_lens(<String> dom_id)
dom_id - The DOM id to unbind
<static> void update_lens_prototype(<String> name, <function> fun, <boolean> no_seq)
Updates the Lens prototype to have a method with the given name that calls the lens function (see make_lens_function()) fun as the second argument to an LSeq, e.g. if the lens foo is added to the prototype, then any lens may call l.foo(...) with meaning seq(l, foo(...)). Naturally, this behavior is not done for seq itself, by setting the third parameter to true.
This function should not be called directly, as #$L will call it for you.
name - The name of the lens
fun - The lens function, from make_lens_function()
no_seq - By default false, set to true to remove the implicit LSeq; instead, the lens (e.g. l in l.foo(...)) will be the first argument to fun, followed by ...
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||