feat(swiper): expose full API (#19137)

* expose full swiper API

* update types

* run build

* run angular build
This commit is contained in:
Liam DeBeasi
2019-08-27 12:25:35 -04:00
committed by GitHub
parent 0e18f049c2
commit e1fa461e9b
5 changed files with 28 additions and 5 deletions

View File

@@ -1068,6 +1068,7 @@ ion-slides,prop,pager,boolean,false,false,false
ion-slides,prop,scrollbar,boolean,false,false,false
ion-slides,method,getActiveIndex,getActiveIndex() => Promise<number>
ion-slides,method,getPreviousIndex,getPreviousIndex() => Promise<number>
ion-slides,method,getSwiper,getSwiper() => Promise<any>
ion-slides,method,isBeginning,isBeginning() => Promise<boolean>
ion-slides,method,isEnd,isEnd() => Promise<boolean>
ion-slides,method,length,length() => Promise<number>

View File

@@ -2388,6 +2388,10 @@ export namespace Components {
*/
'getPreviousIndex': () => Promise<number>;
/**
* Get the Swiper instance. Use this to access the full Swiper API. See https://idangero.us/swiper/api/ for all API options.
*/
'getSwiper': () => Promise<any>;
/**
* Get whether or not the current slide is the first slide.
*/
'isBeginning': () => Promise<boolean>;

View File

@@ -614,6 +614,18 @@ Type: `Promise<number>`
### `getSwiper() => Promise<any>`
Get the Swiper instance.
Use this to access the full Swiper API.
See https://idangero.us/swiper/api/ for all API options.
#### Returns
Type: `Promise<any>`
### `isBeginning() => Promise<boolean>`
Get whether or not the current slide is the first slide.

View File

@@ -320,6 +320,16 @@ export class Slides implements ComponentInterface {
swiper.allowTouchMove = !lock;
}
/**
* Get the Swiper instance.
* Use this to access the full Swiper API.
* See https://idangero.us/swiper/api/ for all API options.
*/
@Method()
async getSwiper(): Promise<any> {
return this.swiper;
}
private async initSwiper() {
const finalOptions = this.normalizeOptions();
@@ -332,10 +342,6 @@ export class Slides implements ComponentInterface {
this.readySwiper(swiper);
}
private getSwiper() {
return this.swiper;
}
private normalizeOptions(): SwiperOptions {
// Base options, can be changed
// TODO Add interface SwiperOptions