Sha256: 0aa335b41d3cc26cc80822da91cfac974bdab9be000405faaa2ec99fb7c5d23b

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

# for browser rendering
module BrowserHelper
  def self.browser_document
    # Work because of the patched version of opal-browser(0.39)
    Browser.window
  end

  def self.browser_attach_(_parents, _html_object, _atome)
    # dummy methods to catch atomes that do not need to be attached to any particular visual atime
  end

  def self.browser_attach_div(parents, html_object, _atome)
    html_object.append_to(browser_document[parents])
  end

  def self.browser_attach_style(parents, _html_object, atome)
    browser_document[parents].add_class(atome[:id])
  end

  def self.browser_attached_div(children, _html_object, atome)
    children.each do |child_found|
      # atome_child.browser_attach_div
      html_child=grab(child_found).browser_object
      html_child.append_to(browser_document[atome[:id]])
    end
  end

  def self.browser_attached_style(children, _html_object, atome)

    browser_document[atome[:id]].add_class(children)
  end

  def self.value_parse(value)
    if value.instance_of?(String)
      value
    else
      "#{value}px"
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atome-0.5.4.0.9 lib/atome/renderers/browser/helpers/browser_helper.rb
atome-0.5.3.8.8 lib/atome/renderers/browser/helpers/browser_helper.rb