Don't put regular parameters after default ones, and $.globalEval -> $.global.

This commit is contained in:
ccd0 2016-07-09 17:04:54 -07:00
parent 2a13c80190
commit ffcfe55fb5

View File

@ -1,9 +1,11 @@
Polyfill =
init: ->
@toBlob()
$.global @toBlob
return
toBlob: ->
return if HTMLCanvasElement::toBlob
HTMLCanvasElement::toBlob = (cb, type='image/png', encoderOptions) ->
HTMLCanvasElement::toBlob = (cb, type='image/png', encoderOptions=null) ->
url = @toDataURL type, encoderOptions
data = atob url[url.indexOf(',')+1..]
# DataUrl to Binary code from Aeosynth's 4chan X repo
@ -12,4 +14,4 @@ Polyfill =
for i in [0...l] by 1
ui8a[i] = data.charCodeAt i
cb new Blob [ui8a], {type}
$.globalEval "HTMLCanvasElement.prototype.toBlob = (#{HTMLCanvasElement::toBlob});"
return