Module: Opal::Httpget

Defined in:
lib/opal/httpget.rb,
lib/opal/httpget/example.rb,
lib/opal/httpget/version.rb

Defined Under Namespace

Classes: Error, Example, Sender

Constant Summary collapse

VERSION =
"0.1.7"

Class Method Summary collapse

Class Method Details

.change_text(id, text) ⇒ Object

おまけ機能: テキストの変更



91
92
93
# File 'lib/opal/httpget.rb', line 91

def change_text(id, text)
  `document.querySelector(id).textContent=text;`
end

.open_window(url) ⇒ Object

おまけ機能: テキストの変更



96
97
98
# File 'lib/opal/httpget.rb', line 96

def open_window(url)
  `window.open( url );`
end

.preload_images(files, &next_proc) ⇒ Object

ここで、先に画像ファイルを読み込む。



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/opal/httpget.rb', line 75

def preload_images(files, &next_proc)
  imnum, targetnum = 0, files.length
  # mypreload(files)
  %x{
    for(var i = 0; i< files.length; i++){
        $("<img>").attr("src", files[i]);
        
        if (i == files.length-1) {
          #{ yield }
        }
    }
  }
end