Skip to content

Commit

Permalink
docs(optional): add syntax to flag params as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
briandennis committed Jul 25, 2016
1 parent d174414 commit f3eb5fd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions scripts/docs/dgeni-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = function(currentVersion, initialVersionBuild) {
.processor(require('./processors/hide-private-api'))
.processor(require('./processors/collect-inputs-outputs'))
.processor(require('./processors/parse-returns-object'))
.processor(require('./processors/parse-optional'))

// for debugging docs
// .processor(function test(){
Expand Down
21 changes: 21 additions & 0 deletions scripts/docs/processors/parse-optional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = function parseOptional() {
return {
$runBefore: ['rendering-docs'],
$process: function(docs) {
docs.forEach(function(doc) {
if(doc.members && doc.members.length) {
for (var i in doc.members) {
if(doc.members[i].params && doc.members[i].params.length) {
for (var ii in doc.members[i].params) {
if(doc.members[i].params[ii].optional){
doc.members[i].params[ii].description += '<strong class="tag">Optional</strong>';
}
}
}
}
}
});
return docs;
}
}
};
12 changes: 6 additions & 6 deletions src/components/slides/slides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ export class Slides extends Ion {
* Transition to the specified slide.
*
* @param {number} index The index number of the slide.
* @param {number} speed Transition duration (in ms). Optional.
* @param {boolean} runCallbacks Whether or not to emit the `ionWillChange`/`ionDidChange` events. Optional. Default true.
* @param {number} [speed] Transition duration (in ms).
* @param {boolean} [runCallbacks] Whether or not to emit the `ionWillChange`/`ionDidChange` events. Default true.
*/
slideTo(index: number, speed?: number, runCallbacks?: boolean) {
this.slider.slideTo(index, speed, runCallbacks);
Expand All @@ -753,8 +753,8 @@ export class Slides extends Ion {
/**
* Transition to the next slide.
*
* @param {number} speed Transition duration (in ms). Optional.
* @param {boolean} runCallbacks Whether or not to emit the `ionWillChange`/`ionDidChange` events. Optional. Default true.
* @param {number} [speed] Transition duration (in ms).
* @param {boolean} [runCallbacks] Whether or not to emit the `ionWillChange`/`ionDidChange` events. Default true.
*/
slideNext(speed?: number, runCallbacks?: boolean) {
this.slider.slideNext(runCallbacks, speed);
Expand All @@ -763,8 +763,8 @@ export class Slides extends Ion {
/**
* Transition to the previous slide.
*
* @param {number} speed Transition duration (in ms). Optional.
* @param {boolean} runCallbacks Whether or not to emit the `ionWillChange`/`ionDidChange` events. Optional. Default true.
* @param {number} [speed] Transition duration (in ms).
* @param {boolean} [runCallbacks] Whether or not to emit the `ionWillChange`/`ionDidChange` events. Default true.
*/
slidePrev(speed?: number, runCallbacks?: boolean) {
this.slider.slidePrev(runCallbacks, speed);
Expand Down

0 comments on commit f3eb5fd

Please sign in to comment.