JSDoc 레퍼런스 해부하기 - 2

2022. 8. 22.·🎨 프론트엔드 공부/JS & TS

참고링크

https://jsdoc.app/

 

Use JSDoc: Index

Index Getting Started Getting Started with JSDoc 3 A quick-start to documenting JavaScript with JSDoc. Using namepaths with JSDoc 3 A guide to using namepaths with JSDoc 3. Command-line arguments to JSDoc About command-line arguments to JSDoc. Configuring

jsdoc.app

 

Using namepaths with JSDoc 3

JSDoc 3 에서의 Namepaths

- 문서의 다른곳에 있는 JavaScript 변수를 참조할 때 해당 변수에 매핑되는 고유 식별자를 제공해야한다

- Namepath는 인스턴스, 스태틱 멤버 및 내부 변수를 명확하게 해준다

 

- 예시 : say 라는 같은 이름을 공유하는 인스턴스, 스태틱, 내부 메서드

 

/** @constructor */
Person = function() {
    this.say = function() {
        return "I'm an instance.";
    }

    function say() {
        return "I'm inner.";
    }
}
Person.say = function() {
    return "I'm static.";
}

var p = new Person();
p.say();      // I'm an instance.
Person.say(); // I'm static.
// there is no way to directly access the inner function from here

/* namepath 기본 문법
Person#say  // the instance method named "say."
Person.say  // the static method named "say."
Person~say  // the inner method named "say."
*/

 

documentation tag를 통한 코드 표현

▶ consider 메서드를 namepath로 표현하면 Person#Idea#consider 가 된다

▷ 예시

 

/** @constructor */
Person = function() {
    /** @constructor */
    this.Idea = function() {
        this.consider = function(){
            return "hmmm";
        }
    }
}

var p = new Person();
var i = new p.Idea();
i.consider();
'🎨 프론트엔드 공부/JS & TS' 카테고리의 다른 글
  • 08 - 제어문
  • 07 - 연산자
  • JSDoc 레퍼런스 해부하기 - 1
  • 06 - 데이터 타입
지식물원
지식물원
지식이 자라는 식물원!
  • 지식물원
    지식물원
    지식물원
  • 전체
    오늘
    어제
    • 분류 전체보기 (510)
      • 🎨 프론트엔드 공부 (247)
        • JS & TS (86)
        • HTML & CSS (22)
        • React & Next (49)
        • Vue & Nuxt (22)
        • 기타 (68)
      • 🤓 기술 학습 & 공부 기록 (116)
        • Node.js (0)
        • Python (37)
        • 백엔드 (0)
        • 딥러닝 (1)
        • 컴퓨터 일반 (72)
        • 개발 인프라 (6)
      • 👨‍💻 프로젝트 경험 (6)
        • Work (0)
        • Toy (6)
      • ⚙️ 개발 팁 & 노하우 (21)
        • 프론트엔드 (6)
        • 기타 (15)
      • ☕️ 커리어 & 인터뷰 준비 (88)
        • 코딩 테스트 (88)
      • 📰 기술 트렌드 & 생각 정리 (4)
      • 📚 기타 (25)
        • 마케팅 (15)
        • 비개발서적 (10)
  • 블로그 메뉴

    • 태그
  • 링크

  • 공지사항

    • 모바일 접속 시 코드 하이라이팅 깨질 때
  • 인기 글

  • hELLO· Designed By정상우.v4.10.3
지식물원
JSDoc 레퍼런스 해부하기 - 2
상단으로

티스토리툴바