Sha256: 249cb8a0071442530e2691c0df6cf596cab9deb881fde78f75451399f2ffb0f4

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

# for browser rendering
module BrowserHelper

  def self.touch_helper_callback(event, proc)
    instance_exec(event, &proc) if proc.is_a?(Proc)
  end

  def self.browser_touch_true(browser_object, proc)
    `
    interact('#'+#{browser_object})
  .on('tap', function (event) {
Opal.BrowserHelper.$touch_helper_callback(event,#{proc});
  })
`
  end

  def self.browser_touch_long(browser_object, proc)
    `
    interact('#'+#{browser_object})
  .on('hold', function (event) {
Opal.BrowserHelper.$touch_helper_callback(event,#{proc});
  })
`
  end

  def self.browser_touch_double(browser_object, proc)
    `
    interact('#'+#{browser_object})
  .on('doubletap', function (event) {
Opal.BrowserHelper.$touch_helper_callback(event,#{proc});
  })
`
  end

  def self.browser_touch_down(browser_object, proc)

    `
    interact('#'+#{browser_object})
  .on('down', function (event) {
Opal.BrowserHelper.$touch_helper_callback(event,#{proc});
  })

`
  end

  def self.browser_touch_up(browser_object, proc)
    `
    interact('#'+#{browser_object})
  .on('up', function (event) {
Opal.BrowserHelper.$touch_helper_callback(event,#{proc});
  })
`
  end

end


Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
atome-0.5.3.4 lib/atome/renderers/browser/helpers/event_helper.rb
atome-0.5.3.2 lib/atome/renderers/browser/helpers/event_helper.rb
atome-0.5.2.8 lib/atome/renderers/browser/helpers/event_helper.rb
atome-0.5.2.7 lib/atome/renderers/browser/helpers/event_helper.rb
atome-0.5.2.5 lib/atome/renderers/browser/helpers/event_helper.rb