Created
April 30, 2010 00:37
-
-
Save ericf/384518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Y.datauri('http://example.com/foo.png', function(fooDataURI){ | |
| Y.one('body').append(Y.Node.create('<img/>').set('src', fooDataURI)); | |
| }); | |
| Y.datauri('http://example.com/foo.png', 'http://example.com/bar.png', function(foo, bar){ | |
| }); | |
| Y.datauri(['http://example.com/foo.png', 'http://example.com/bar.png'], function(datauris){ | |
| // datauris is an array because array was passed in | |
| }); | |
| Y.datauri('/baz.jpg', function(bazDataURI){ | |
| // generate absolute reference to baz using window.location and/or <base href="" /> | |
| }); | |
| Y.datauri(['http://example.com/foo.png', 'http://example.com/bar.png'], { | |
| on : { | |
| data : function (datauris) { | |
| // support chunking requests to YQL but getting responses fast | |
| // { 'http://example.com/foo.png': 'sadjfhklsajdf239487asdfhkj' } | |
| // have to key the data coming back because we're not sure the order requests will return in | |
| // the key for the dataURI is the corresponding passed into the function. | |
| }, | |
| complete : function (datauris) { | |
| // all data URIs have been loaded and generated, datauris is an array | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment