From 1dd552765568ba272dcc132a4889140c259b3ff1 Mon Sep 17 00:00:00 2001 From: Andy Joslin Date: Mon, 10 Mar 2014 19:48:15 -0600 Subject: [PATCH] docs(ionicSlideBox): add documentation Some methods were renamed solely to make the phrasing be the same across the entire project (abbreviations versus not, and tabbar uses index wording while this used position). BREAKING CHANGE: ionicSlideBox#getPos has been renamed to ionicSlideBox#currentIndex. ionicSlideBox#numSlides has been renamed to ionicSlideBox#slidesCount. --- js/ext/angular/src/directive/ionicSlideBox.js | 8 ++-- js/views/sliderView.js | 44 ++++++++++++++++++- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/js/ext/angular/src/directive/ionicSlideBox.js b/js/ext/angular/src/directive/ionicSlideBox.js index 3bd1fa5655..cf1c5fa2ff 100644 --- a/js/ext/angular/src/directive/ionicSlideBox.js +++ b/js/ext/angular/src/directive/ionicSlideBox.js @@ -65,7 +65,7 @@ angular.module('ionic.ui.slideBox', []) continuous: continuous, startSlide: $scope.activeSlide, slidesChanged: function() { - $scope.currentSlide = slider.getPos(); + $scope.currentSlide = slider.currentIndex(); // Try to trigger a digest $timeout(function() {}); @@ -102,8 +102,8 @@ angular.module('ionic.ui.slideBox', []) $ionicSlideBoxDelegate.register($scope, $element); - this.getNumSlides = function() { - return slider.getNumSlides(); + this.slidesCount = function() { + return slider.slidesCount(); }; $timeout(function() { @@ -158,7 +158,7 @@ angular.module('ionic.ui.slideBox', []) }; $scope.numSlides = function() { - return new Array(slideBox.getNumSlides()); + return new Array(slideBox.slidesCount()); }; $scope.$watch('currentSlide', function(v) { diff --git a/js/views/sliderView.js b/js/views/sliderView.js index 410e92665e..259b1f175e 100644 --- a/js/views/sliderView.js +++ b/js/views/sliderView.js @@ -6,6 +6,14 @@ * */ +/** + * @ngdoc controller + * @name ionicSlideBox + * @module ionic + * @description + * Controller for the {@link ionic.directive:ionTabs ionTabs} directive. + */ + (function(ionic) { 'use strict'; @@ -465,6 +473,12 @@ ionic.views.Slider = ionic.views.View.inherit({ setup(); }; + /** + * @ngdoc method + * @name ionicSlideBox#slide + * @param {number} to The index to slide to. + * @param {number=} speed The number of milliseconds for the change to take. + */ this.slide = function(to, speed) { // cancel slideshow stop(); @@ -472,6 +486,11 @@ ionic.views.Slider = ionic.views.View.inherit({ slide(to, speed); }; + /** + * @ngdoc method + * @name ionicSlideBox#prev + * @description Go to the previous slide. Wraps around if at the beginning. + */ this.prev = function() { // cancel slideshow stop(); @@ -479,6 +498,11 @@ ionic.views.Slider = ionic.views.View.inherit({ prev(); }; + /** + * @ngdoc method + * @name ionicSlideBox#next + * @description Go to the next slide. Wraps around if at the end. + */ this.next = function() { // cancel slideshow stop(); @@ -486,17 +510,33 @@ ionic.views.Slider = ionic.views.View.inherit({ next(); }; + /** + * @ngdoc method + * @name ionicSlideBox#stop + * @description Stop sliding. The slideBox will not move again until + * explicitly told to do so. + */ this.stop = function() { // cancel slideshow stop(); }; - this.getPos = function() { + /** + * @ngdoc method + * @name ionicSlideBox#currentIndex + * @returns {number} index The index of the current slide. + */ + this.currentIndex = function() { // return current index position return index; }; - this.getNumSlides = function() { + /** + * @ngdoc method + * @name ionicSlideBox#slidesCount + * @returns {number} count The number of slides there are currently. + */ + this.slidesCount = function() { // return total number of slides return length; };