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.4"

Class Method Summary collapse

Class Method Details

.mypreload(files) ⇒ Object

画像プリロードの構文。参考: www.webdesignleaves.com/wp/jquery/1355/



65
66
67
68
69
70
71
# File 'lib/opal/httpget.rb', line 65

def mypreload(files)
  %x{
    for(var i = 0; i< files.length; i++){
        $("<img>").attr("src", files[i]);
    }
  }
end

.preload_images(files, &next_proc) ⇒ Object

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



74
75
76
77
78
# File 'lib/opal/httpget.rb', line 74

def preload_images(files, &next_proc)
  imnum, targetnum = 0, files.length
  mypreload(files)
  yield
end