Skip to content

Commit f3eb5fd

Browse files
committed
docs(optional): add syntax to flag params as optional
1 parent d174414 commit f3eb5fd

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

scripts/docs/dgeni-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = function(currentVersion, initialVersionBuild) {
2424
.processor(require('./processors/hide-private-api'))
2525
.processor(require('./processors/collect-inputs-outputs'))
2626
.processor(require('./processors/parse-returns-object'))
27+
.processor(require('./processors/parse-optional'))
2728

2829
// for debugging docs
2930
// .processor(function test(){
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = function parseOptional() {
2+
return {
3+
$runBefore: ['rendering-docs'],
4+
$process: function(docs) {
5+
docs.forEach(function(doc) {
6+
if(doc.members && doc.members.length) {
7+
for (var i in doc.members) {
8+
if(doc.members[i].params && doc.members[i].params.length) {
9+
for (var ii in doc.members[i].params) {
10+
if(doc.members[i].params[ii].optional){
11+
doc.members[i].params[ii].description += '<strong class="tag">Optional</strong>';
12+
}
13+
}
14+
}
15+
}
16+
}
17+
});
18+
return docs;
19+
}
20+
}
21+
};

src/components/slides/slides.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ export class Slides extends Ion {
743743
* Transition to the specified slide.
744744
*
745745
* @param {number} index The index number of the slide.
746-
* @param {number} speed Transition duration (in ms). Optional.
747-
* @param {boolean} runCallbacks Whether or not to emit the `ionWillChange`/`ionDidChange` events. Optional. Default true.
746+
* @param {number} [speed] Transition duration (in ms).
747+
* @param {boolean} [runCallbacks] Whether or not to emit the `ionWillChange`/`ionDidChange` events. Default true.
748748
*/
749749
slideTo(index: number, speed?: number, runCallbacks?: boolean) {
750750
this.slider.slideTo(index, speed, runCallbacks);
@@ -753,8 +753,8 @@ export class Slides extends Ion {
753753
/**
754754
* Transition to the next slide.
755755
*
756-
* @param {number} speed Transition duration (in ms). Optional.
757-
* @param {boolean} runCallbacks Whether or not to emit the `ionWillChange`/`ionDidChange` events. Optional. Default true.
756+
* @param {number} [speed] Transition duration (in ms).
757+
* @param {boolean} [runCallbacks] Whether or not to emit the `ionWillChange`/`ionDidChange` events. Default true.
758758
*/
759759
slideNext(speed?: number, runCallbacks?: boolean) {
760760
this.slider.slideNext(runCallbacks, speed);
@@ -763,8 +763,8 @@ export class Slides extends Ion {
763763
/**
764764
* Transition to the previous slide.
765765
*
766-
* @param {number} speed Transition duration (in ms). Optional.
767-
* @param {boolean} runCallbacks Whether or not to emit the `ionWillChange`/`ionDidChange` events. Optional. Default true.
766+
* @param {number} [speed] Transition duration (in ms).
767+
* @param {boolean} [runCallbacks] Whether or not to emit the `ionWillChange`/`ionDidChange` events. Default true.
768768
*/
769769
slidePrev(speed?: number, runCallbacks?: boolean) {
770770
this.slider.slidePrev(runCallbacks, speed);

0 commit comments

Comments
 (0)