블로그 이미지
윤영식
Full Stacker, Application Architecter, KnowHow Dispenser and Bike Rider

Publication

Category

Recent Post

2012. 12. 10. 17:22 NodeJS/Concept

전역범위에서 참조가 가능한 글로벌 오브젝트. already defined object라고 할 수 있겠다. 



global objects 
> 하기 객체는 모든 모듈에서 이용할 수 있다. 실제 전역 범위를 가진다 
> node에서 var something의 something은 지역범위만 갖는다 
> global : {Object} 전역 네임스페이스 객체 
> process, console : {Object}
> Class: Buffer : {Function} 바이너리 데이터를 다루는데 사용 
> require() : 모듈 로딩으로 지역범위임
> __filename : {String} 실행되는 코드의 파일명 (코드의 절대경로 포함)
> __dirname : {String} 현재 실행되는 스크립트가 존재하는 디렉토리 경로 
> module : {Object} 현재 모듈에 대한 참조. 특히 module.exports는 exports 객체와 같다 
> exports : require()로 접근가능하게 된 모듈의 모든 인스턴스 사이에서 공유되는 객체다. 
> setTimeouts(cb, ms) : cb=callback, ms=milliseconds
  clearTimeout(t) : setTimeout()올 생성된 타이머를 멈춘다
> setInterval(cb, ms) : 반복적으로 callback 수행
  clearInterval(t)


>> fileName : globalTest.js

console.log(__filename);

console.log(__dirname);


>> 수행 

D:\Framework\Node.js> node globalTest

D:\Framework\Node.js\globalTest.js

D:\Framework\Node.js


'NodeJS > Concept' 카테고리의 다른 글

[Jade] Jade 사용하기  (0) 2012.12.15
[EJS] 사용하기  (0) 2012.12.15
[Node.js] File I/O 사용하기  (0) 2012.12.10
[Node.js] EventEmitter 에 대하여  (0) 2012.12.10
[Node.js] debugger 사용하기  (0) 2012.12.10
posted by 윤영식