method.tmpl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?js
  2. var data = obj;
  3. var self = this;
  4. ?>
  5. <?js if (data.kind !== 'module' && !data.hideconstructor) { ?>
  6. <?js if (data.kind === 'class' && data.classdesc) { ?>
  7. <h2>Constructor</h2>
  8. <?js } ?>
  9. <h4 class="name" id="<?js= id ?>"><?js= data.attribs ?><?js
  10. if(kind === 'class' && name.indexOf('module:') === 0) {
  11. print('new (require("' + name.slice(7) + '"))');
  12. } else if(kind === 'class') {
  13. print('new ' + name);
  14. } else if(kind === 'event' && data.alias) {
  15. print(data.alias);
  16. } else {
  17. print(name);
  18. }
  19. ?><?js= (data.signature || '') ?></h4>
  20. <?js if (data.summary) { ?>
  21. <p class="summary usertext"><?js= summary ?></p>
  22. <?js } ?>
  23. <?js } ?>
  24. <?js= this.partial('details.tmpl', data) ?>
  25. <?js if (data.augments && data.alias && data.alias.indexOf('module:') === 0) { ?>
  26. <h5 class="h5-extends">Extends:</h5>
  27. <?js= self.partial('augments.tmpl', data) ?>
  28. <?js } ?>
  29. <?js if (kind === 'event' && data.type && data.type.names) {?>
  30. <h5 class="h5-types">Type:</h5>
  31. <ul>
  32. <li>
  33. <?js= self.partial('type.tmpl', data.type.names) ?>
  34. </li>
  35. </ul>
  36. <?js } ?>
  37. <?js if (data['this']) { ?>
  38. <h5 class="h5-this">This:</h5>
  39. <ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul>
  40. <?js } ?>
  41. <?js if (data.examples && examples.length) { ?>
  42. <h5 class="h5-examples">Example<?js= examples.length > 1? 's':'' ?></h5>
  43. <?js= this.partial('examples.tmpl', examples) ?>
  44. <?js } ?>
  45. <?js if (data.params && params.length) { ?>
  46. <h5 class="h5-parameters">Parameters:</h5>
  47. <?js= this.partial('params.tmpl', params) ?>
  48. <?js } ?>
  49. <?js if (data.kind !== 'module' && data.requires && data.requires.length) { ?>
  50. <h5 class="h5-requires">Requires:</h5>
  51. <ul><?js data.requires.forEach(function(r) { ?>
  52. <li><?js= self.linkto(r) ?></li>
  53. <?js }); ?></ul>
  54. <?js } ?>
  55. <?js if (data.fires && fires.length) { ?>
  56. <h5 class="h5-fires">Fires:</h5>
  57. <ul><?js fires.forEach(function(f) { ?>
  58. <li><?js= self.linkto(f) ?></li>
  59. <?js }); ?></ul>
  60. <?js } ?>
  61. <?js if (data.listens && listens.length) { ?>
  62. <h5 class="h5-listens">Listens to Events:</h5>
  63. <ul><?js listens.forEach(function(f) { ?>
  64. <li><?js= self.linkto(f) ?></li>
  65. <?js }); ?></ul>
  66. <?js } ?>
  67. <?js if (data.listeners && listeners.length) { ?>
  68. <h5 class="h5-listeners">Listeners of This Event:</h5>
  69. <ul><?js listeners.forEach(function(f) { ?>
  70. <li><?js= self.linkto(f) ?></li>
  71. <?js }); ?></ul>
  72. <?js } ?>
  73. <?js if (data.modifies && modifies.length) {?>
  74. <h5 class="h5-modifies">Modifies:</h5>
  75. <?js if (modifies.length > 1) { ?><ul><?js
  76. modifies.forEach(function(m) { ?>
  77. <li><?js= self.partial('modifies.tmpl', m) ?></li>
  78. <?js });
  79. ?></ul><?js } else {
  80. modifies.forEach(function(m) { ?>
  81. <?js= self.partial('modifies.tmpl', m) ?>
  82. <?js });
  83. } } ?>
  84. <?js if (data.exceptions && exceptions.length) { ?>
  85. <h5 class="h5-throws">Throws:</h5>
  86. <?js if (exceptions.length > 1) { ?><ul><?js
  87. exceptions.forEach(function(r) { ?>
  88. <li><?js= self.partial('exceptions.tmpl', r) ?></li>
  89. <?js });
  90. ?></ul><?js } else {
  91. exceptions.forEach(function(r) { ?>
  92. <?js= self.partial('exceptions.tmpl', r) ?>
  93. <?js });
  94. } } ?>
  95. <?js if (data.returns && returns.length) { ?>
  96. <h5 class="h5-returns">Returns:</h5>
  97. <?js if (returns.length > 1) { ?><ul><?js
  98. returns.forEach(function(r) { ?>
  99. <li><?js= self.partial('returns.tmpl', r) ?></li>
  100. <?js });
  101. ?></ul><?js } else {
  102. returns.forEach(function(r) { ?>
  103. <?js= self.partial('returns.tmpl', r) ?>
  104. <?js });
  105. } } ?>
  106. <?js if (data.yields && yields.length) { ?>
  107. <h5 class="h5-yields">Yields:</h5>
  108. <?js if (yields.length > 1) { ?><ul><?js
  109. yields.forEach(function(r) { ?>
  110. <li><?js= self.partial('returns.tmpl', r) ?></li>
  111. <?js });
  112. ?></ul><?js } else {
  113. yields.forEach(function(r) { ?>
  114. <?js= self.partial('returns.tmpl', r) ?>
  115. <?js });
  116. } } ?>