Module: Prawn::JS
- Defined in:
- lib/prawn/js.rb
Constant Summary collapse
- NAME_TREE_CHILDREN_LIMIT =
The maximum number of children to fit into a single node in the JavaScript tree.
20
Instance Method Summary collapse
-
#add_did_print_js(script) ⇒ Object
add a Javascript fragment that will execute after the document is printed.
-
#add_did_save_js(script) ⇒ Object
add a Javascript fragment that will execute after the document is saved.
-
#add_docopen_js(name, script) ⇒ Object
add a Javascript fragment that will execute when the document is opened.
-
#add_will_close_js(script) ⇒ Object
add a Javascript fragment that will execute when the document is closed.
-
#add_will_print_js(script) ⇒ Object
add a Javascript fragment that will execute before the document is printed.
-
#add_will_save_js(script) ⇒ Object
add a Javascript fragment that will execute before the document is saved.
Instance Method Details
#add_did_print_js(script) ⇒ Object
add a Javascript fragment that will execute after the document is printed.
There can only be a single fragment. Calling this function multiple times will override earlier fragments.
28 29 30 |
# File 'lib/prawn/js.rb', line 28 def add_did_print_js(script) aa[:DP] = ref!(:S => :JavaScript, :JS => script) end |
#add_did_save_js(script) ⇒ Object
add a Javascript fragment that will execute after the document is saved.
There can only be a single fragment. Calling this function multiple times will override earlier fragments.
19 20 21 |
# File 'lib/prawn/js.rb', line 19 def add_did_save_js(script) aa[:DS] = ref!(:S => :JavaScript, :JS => script) end |
#add_docopen_js(name, script) ⇒ Object
add a Javascript fragment that will execute when the document is opened.
There can only be as many fragments as required. Calling this function multiple times will append the new fragment to the list.
37 38 39 40 |
# File 'lib/prawn/js.rb', line 37 def add_docopen_js(name, script) obj = ref!(:S => :JavaScript, :JS => script) javascript.data.add(name, obj) end |
#add_will_close_js(script) ⇒ Object
add a Javascript fragment that will execute when the document is closed.
There can only be a single fragment. Calling this function multiple times will override earlier fragments.
47 48 49 |
# File 'lib/prawn/js.rb', line 47 def add_will_close_js(script) aa[:WC] = ref!(:S => :JavaScript, :JS => script) end |
#add_will_print_js(script) ⇒ Object
add a Javascript fragment that will execute before the document is printed.
There can only be a single fragment. Calling this function multiple times will override earlier fragments.
56 57 58 |
# File 'lib/prawn/js.rb', line 56 def add_will_print_js(script) aa[:WP] = ref!(:S => :JavaScript, :JS => script) end |
#add_will_save_js(script) ⇒ Object
add a Javascript fragment that will execute before the document is saved.
There can only be a single fragment. Calling this function multiple times will override earlier fragments.
65 66 67 |
# File 'lib/prawn/js.rb', line 65 def add_will_save_js(script) aa[:WS] = ref!(:S => :JavaScript, :JS => script) end |