16
17
18
19
20
21
22
23
|
# File 'lib/touch_action/script_generator.rb', line 16
def self.generate_javascript action, options = {}
action = :flick if action == :swipe
raise ArgumentError, "The touch action #{action} doesn't exist" unless ACTIONS_WITH_DEFAULT_OPTIONS[action]
script = File.read(File.expand_path("../javascripts/touch_action.js.erb", __FILE__))
default_options = ACTIONS_WITH_DEFAULT_OPTIONS[action]
arguments = {gesture: action.to_s, options: default_options.merge(options)}
render_erb(script, arguments)
end
|