Sha256: 817096f44f9d6264fe4da996bcafb0181790ca7143c8d2f54ad947a35073d658

Contents?: true

Size: 347 Bytes

Versions: 4

Compression:

Stored size: 347 Bytes

Contents

class Trix.ImagePreloadOperation extends Trix.Operation
  constructor: (@url) ->

  perform: (callback) ->
    image = new Image

    image.onload = =>
      image.width = @width = image.naturalWidth
      image.height = @height = image.naturalHeight
      callback(true, image)

    image.onerror = ->
      callback(false)

    image.src = @url

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vapid-0.1.3 lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee
vapid-0.1.2 lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee
vapid-0.1.1 lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee
vapid-0.1.0 lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee