ݺߣ

ݺߣShare a Scribd company logo
JavaScript




2011-07-15 CA  pixiv


         1
2
3
4
pixiv.lazyImage




       5
6
<img
       class="ui-lazy-image"
       src="transparent.png"
       data-src=/slideshow/javascript-8632523/8632523/"image.png"
>




                               7
8
pixiv.throttle




      9
10
$(window).scroll($.proxy(this.onscroll, this));

!

$(window).scroll(pixiv.throttle(this.onscroll, this));




                                  11
12
pixiv.api.request

   $.ajax + Storage API




            13
14
pixiv.api.get('/api/foo', queries);

// sessionStorage
pixiv.api.get('/api/foo', queries, {cache: true});

// localStorage
pixiv.api.get('/api/foo', queries, {cache: +new Date + 604800000}); // 1w

// Object
pixiv.api.get('/api/foo', queries, {cache: pixiv.foo.data});




                                  15
// jQuery Deferred
pixiv.api.get('/api/foo', queries, {cache: true})
	 .done(function(data) {
	 	 ...
	 })
	 .fail(function(e) {
	 	 ...
	 });




                                  16
17
18
19
p(ixi)v <




            20

More Related Content

2011-07-15 `˥󥰤Sˤʤ JavaScript