MyApi.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**
  2. * @summary This is the test summary for the `MyApi` namespace.
  3. * @namespace MyApi
  4. * @description This is the longer description for the namespace giving a better idea about the code contained within it.
  5. */
  6. window.MyApi = {
  7. /**
  8. * @summary This is a static member of the namespace.
  9. * @memberof MyApi.
  10. * @name staticMember
  11. * @type {string}
  12. * @default I'm a member of the MyApi namespace.
  13. */
  14. staticMember: "I'm a member of the MyApi namespace."
  15. };
  16. /**
  17. * @summary This is a test type definition on the MyApi namespace.
  18. * @memberof MyApi~
  19. * @typedef {Object} Object
  20. * @prop {string} name - This is the name of the test object.
  21. * @prop {boolean} [enabled=false] - This is whether or not the test object is enabled. Defaults to `false`.
  22. */
  23. /**
  24. * @summary This is the summary of the MyApi test class, test `markdown`.
  25. * @memberof MyApi
  26. * @constructor Class
  27. * @param {string} arg1 - The first test arg, test `markdown`.
  28. * @param {...string} [arg2=false] - A repeatable, optional argument with a default value of false, test `markdown`.
  29. * @description This is the description for the class this is meant to be a more in depth explanation of what this class does and it's general use case, test `markdown`
  30. * @example {@caption You can provide example captions with `markdown` and specify the language to use when rendering the code, defaults to `javascript`.}
  31. * var gc = new GlobalClass("arg1", "arg2");
  32. * @example {@lang xml}
  33. * <head>
  34. * <title>HTML Highlighting</title>
  35. * <script>
  36. * // supports embedded languages
  37. * var gc = new GlobalClass("arg1", "arg2");
  38. * </script>
  39. * </head>
  40. */
  41. MyApi.Class = function(arg1, arg2){
  42. /**
  43. * @summary I'm a member of the class.
  44. * @memberof MyApi.Class#
  45. * @name publicMember
  46. * @type {string}
  47. * @default "I'm an instance member."
  48. */
  49. this.publicMember = "I'm an instance member.";
  50. /**
  51. * @summary I'm a protected member of the class.
  52. * @memberof MyApi.Class#
  53. * @name protectedMember
  54. * @type {string}
  55. * @default "I'm a protected member."
  56. * @protected
  57. */
  58. this.protectedMember = "I'm a protected member.";
  59. /**
  60. * @summary I'm a private member of the class.
  61. * @memberof MyApi.Class#
  62. * @name _privateMember
  63. * @type {string}
  64. * @default "I'm a private member."
  65. * @private
  66. */
  67. this._privateMember = "I'm a private member.";
  68. };
  69. /**
  70. * @summary This is a test instance method of the MyApi test class, test `markdown`.
  71. * @memberof MyApi.Class#
  72. * @function testMethod
  73. * @param {*} value - Any value, test `markdown`
  74. * @param {Object} obj - The first object of what could be many, test `markdown`
  75. * @param {...Object} [objN] - Any additional objects, test `markdown`
  76. * @returns {Object} The combination of all the objects, test `markdown`.
  77. * @description This method is not overridden in the {@link MyApi.Child} class but is simply inherited.
  78. * @fires MyApi.Class~"test.my-api"
  79. * @throws {CustomError} This is thrown when some condition fails within this method.
  80. */
  81. MyApi.Class.prototype.testMethod = function(value, obj, objN){
  82. /**
  83. * @summary This is an event raised by this class, it's documentation appears on this page as the event is specified as an inner member the class by using the tilde (~) scope.
  84. * @memberof MyApi.Class~
  85. * @event "test.my-api"
  86. * @param {Event} e - The event object.
  87. * @param {*} custom - Some custom parameter passed to any listeners.
  88. */
  89. throw new CustomError("Some custom error.");
  90. };
  91. /**
  92. * @summary This is a another test instance method of the MyApi test class, test `markdown`.
  93. * @memberof MyApi.Class#
  94. * @function anotherMethod
  95. * @param {*} value - Any value, test `markdown`
  96. * @param {Object} obj - The first object of what could be many, test `markdown`
  97. * @param {...Object} [objN] - Any additional objects, test `markdown`
  98. * @returns {Object} The combination of all the objects, test `markdown`.
  99. * @description This method is overridden in the {@link MyApi.Child} class and should remove the exception documentation as it no longer applies.
  100. * @fires MyApi.Class~"another.my-api"
  101. * @throws {CustomError} This is thrown when some condition fails within this method.
  102. */
  103. MyApi.Class.prototype.anotherMethod = function(value, obj, objN){
  104. /**
  105. * @summary This is an event raised by this class, it's documentation appears on this page as the event is specified as an inner member the class by using the tilde (~) scope.
  106. * @memberof MyApi.Class~
  107. * @event "another.my-api"
  108. * @param {Event} e - The event object.
  109. * @param {*} custom - Some custom parameter passed to any listeners.
  110. */
  111. };
  112. /**
  113. * @summary This is a test type definition on the MyApi.Class class.
  114. * @memberof MyApi.Class~
  115. * @typedef {Object} Object
  116. * @prop {string} name - The name of the test object.
  117. * @prop {boolean} [enabled=false] - Whether or not the test object is enabled. Defaults to `false`.
  118. * @prop {Object} sub - An object containing a subset of properties.
  119. * @prop {number} sub.id - The subset id.
  120. * @prop {boolean} [sub.name="Sub Options"] - The name of the sub object. Defaults to `"Sub Options"`.
  121. */
  122. /**
  123. * @summary This is the summary of the MyApi child class, test `markdown`.
  124. * @memberof MyApi
  125. * @constructor Child
  126. * @extends MyApi.Class
  127. */
  128. MyApi.Child = function(){
  129. /**
  130. * @summary I'm a protected member of the class.
  131. * @memberof MyApi.Child#
  132. * @name protectedMember
  133. * @type {string}
  134. * @default "I'm a protected member."
  135. * @protected
  136. */
  137. this.protectedMember = "I'm a protected member.";
  138. };
  139. /**
  140. * @summary This is a another test instance method of the MyApi child class, test `markdown`.
  141. * @memberof MyApi.Child#
  142. * @function anotherMethod
  143. * @param {*} value - Any value, test `markdown`
  144. * @param {Object} obj - The first object of what could be many, test `markdown`
  145. * @param {...Object} [objN] - Any additional objects, test `markdown`
  146. * @returns {Object} The combination of all the objects, test `markdown`.
  147. * @description This method overrides the {@link MyApi.Class#anotherMethod} and should remove the exception documentation as it no longer applies. The event should also be updated to reflect it is raised by this class and not the inherited one.
  148. * @fires MyApi.Child~"another.my-api"
  149. */
  150. MyApi.Child.prototype.anotherMethod = function(value, obj, objN){
  151. /**
  152. * @summary This is an event raised by this class, it's documentation appears on this page as the event is specified as an inner member the class by using the tilde (~) scope.
  153. * @memberof MyApi.Child~
  154. * @event "another.my-api"
  155. * @param {Event} e - The event object.
  156. * @param {*} custom - Some custom parameter passed to any listeners.
  157. */
  158. };