Created
March 15, 2012 05:30
-
-
Save safe1981/2042160 to your computer and use it in GitHub Desktop.
javascript: jquery plugin작성 시에 기본으로 적용하는 초기 구조
This file contains 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
//플러그인 작성기법 | |
//window, document와 같은 전역변수를 굳이 넘기는 이유 | |
//1. Local변수에 캐싱하여 효과를 높이는 효과 | |
//2. 코드 압축 수행시 효과적으로 압축가능 window=>a. document=>b 등 | |
//undefined를 마지막에 쓰는 이유, 악의적으로 undefined변조가능 | |
(function( $, window, document, undefined ) { | |
$.fn.queryTwitter = function() { | |
console.log("test"); | |
}; | |
})( jQuery, window, document ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment