mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
chore(noImplicitAny): add noImplicitAny to tsconfig
This commit is contained in:
@ -40,32 +40,32 @@ export class App {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewDidLoad: EventEmitter<any> = new EventEmitter();
|
||||
viewDidLoad: EventEmitter<ViewController> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewWillEnter: EventEmitter<any> = new EventEmitter();
|
||||
viewWillEnter: EventEmitter<ViewController> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewDidEnter: EventEmitter<any> = new EventEmitter();
|
||||
viewDidEnter: EventEmitter<ViewController> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewWillLeave: EventEmitter<any> = new EventEmitter();
|
||||
viewWillLeave: EventEmitter<ViewController> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewDidLeave: EventEmitter<any> = new EventEmitter();
|
||||
viewDidLeave: EventEmitter<ViewController> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewWillUnload: EventEmitter<any> = new EventEmitter();
|
||||
viewWillUnload: EventEmitter<ViewController> = new EventEmitter();
|
||||
|
||||
constructor(
|
||||
private _config: Config,
|
||||
|
@ -259,6 +259,6 @@ function mockButton(config?: Config, ionButton?: string) {
|
||||
return b;
|
||||
}
|
||||
|
||||
function hasClass(button, className) {
|
||||
function hasClass(button: any, className: string) {
|
||||
return button._elementRef.nativeElement.classList.contains(className);
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ export class DateTime extends Ion implements AfterContentInit, ControlValueAcces
|
||||
// then check to see if they're in the config
|
||||
// if neither were provided then it will use default English names
|
||||
['monthNames', 'monthShortNames', 'dayNames', 'dayShortNames'].forEach(type => {
|
||||
this._locale[type] = convertToArrayOfStrings(isPresent(this[type]) ? this[type] : this._config.get(type), type);
|
||||
(<any>this)._locale[type] = convertToArrayOfStrings(isPresent((<any>this)[type]) ? (<any>this)[type] : this._config.get(type), type);
|
||||
});
|
||||
|
||||
// update how the datetime value is displayed as formatted text
|
||||
|
@ -161,29 +161,30 @@ export class Icon extends Ion {
|
||||
* @private
|
||||
*/
|
||||
update() {
|
||||
let name;
|
||||
let iconName: string;
|
||||
|
||||
if (this._ios && this._iconMode === 'ios') {
|
||||
name = this._ios;
|
||||
iconName = this._ios;
|
||||
} else if (this._md && this._iconMode === 'md') {
|
||||
name = this._md;
|
||||
iconName = this._md;
|
||||
} else {
|
||||
name = this._name;
|
||||
iconName = this._name;
|
||||
}
|
||||
let hidden = this._hidden = (name === null);
|
||||
let hidden = this._hidden = (iconName === null);
|
||||
if (hidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
let iconMode = name.split('-', 2)[0];
|
||||
let iconMode = iconName.split('-', 2)[0];
|
||||
if (
|
||||
iconMode === 'ios' &&
|
||||
!this._isActive &&
|
||||
name.indexOf('logo-') < 0 &&
|
||||
name.indexOf('-outline') < 0) {
|
||||
name += '-outline';
|
||||
iconName.indexOf('logo-') < 0 &&
|
||||
iconName.indexOf('-outline') < 0) {
|
||||
iconName += '-outline';
|
||||
}
|
||||
|
||||
let css = 'ion-' + name;
|
||||
let css = 'ion-' + iconName;
|
||||
if (this._css === css) {
|
||||
return;
|
||||
}
|
||||
@ -193,7 +194,7 @@ export class Icon extends Ion {
|
||||
this._css = css;
|
||||
this.setElementClass(css, true);
|
||||
|
||||
let label = name
|
||||
let label = iconName
|
||||
.replace('ios-', '')
|
||||
.replace('md-', '')
|
||||
.replace('-', ' ');
|
||||
|
@ -48,7 +48,7 @@ describe('Img', () => {
|
||||
});
|
||||
|
||||
|
||||
let contentElementRef;
|
||||
let contentElementRef: any;
|
||||
let img: Img;
|
||||
let elementRef: ElementRef;
|
||||
let renderer: Renderer;
|
||||
|
@ -95,8 +95,8 @@ describe('Infinite Scroll', () => {
|
||||
let config = mockConfig();
|
||||
let inf: InfiniteScroll;
|
||||
let content: Content;
|
||||
let contentElementRef;
|
||||
let infiniteElementRef;
|
||||
let contentElementRef: any;
|
||||
let infiniteElementRef: any;
|
||||
let ev: ScrollEvent = (<any>{});
|
||||
let dom: DomController;
|
||||
|
||||
@ -112,15 +112,15 @@ describe('Infinite Scroll', () => {
|
||||
inf = new InfiniteScroll(content, mockZone(), infiniteElementRef, dom);
|
||||
});
|
||||
|
||||
function setInfiniteScrollTop(scrollTop) {
|
||||
function setInfiniteScrollTop(scrollTop: any) {
|
||||
infiniteElementRef.nativeElement.scrollTop = scrollTop;
|
||||
}
|
||||
|
||||
function setInfiniteScrollHeight(scrollHeight) {
|
||||
function setInfiniteScrollHeight(scrollHeight: any) {
|
||||
infiniteElementRef.nativeElement.scrollHeight = scrollHeight;
|
||||
}
|
||||
|
||||
function mockGetContentDimensions(scrollHeight, scrollTop, contentHeight) {
|
||||
function mockGetContentDimensions(scrollHeight: any, scrollTop: any, contentHeight: any): any {
|
||||
return {
|
||||
scrollHeight: scrollHeight,
|
||||
scrollTop: scrollTop,
|
||||
|
@ -39,7 +39,7 @@ export class OverlayPortal extends NavControllerBase {
|
||||
|
||||
// on every page change make sure the portal has
|
||||
// dismissed any views that should be auto dismissed on page change
|
||||
app.viewDidLeave.subscribe((ev) => {
|
||||
app.viewDidLeave.subscribe((ev: any) => {
|
||||
!ev.isOverlay && this.dismissPageChangeViews();
|
||||
});
|
||||
}
|
||||
|
@ -314,7 +314,18 @@ export class PickerColumnCmp {
|
||||
// ensure we've got a good round number :)
|
||||
y = Math.round(y);
|
||||
|
||||
let i, button, opt, optOffset, visible, translateX, translateY, translateZ, rotateX, transform, selected;
|
||||
let i: number;
|
||||
let button: any;
|
||||
let opt: any;
|
||||
let optOffset: number;
|
||||
let visible: boolean;
|
||||
let translateX: number;
|
||||
let translateY: number;
|
||||
let translateZ: number;
|
||||
let rotateX: number;
|
||||
let transform: string;
|
||||
let selected: boolean;
|
||||
|
||||
const parent = this.colEle.nativeElement;
|
||||
const children = parent.children;
|
||||
const length = children.length;
|
||||
|
@ -225,7 +225,7 @@ describe('Refresher', () => {
|
||||
});
|
||||
|
||||
|
||||
let contentElementRef;
|
||||
let contentElementRef: any;
|
||||
let refresher: Refresher;
|
||||
let content: Content;
|
||||
let dom: any;
|
||||
@ -251,7 +251,7 @@ describe('Refresher', () => {
|
||||
};
|
||||
}
|
||||
|
||||
function setContentScrollTop(scrollTop) {
|
||||
function setContentScrollTop(scrollTop: any) {
|
||||
content.getContentDimensions = function() {
|
||||
return {
|
||||
scrollTop: scrollTop,
|
||||
|
@ -499,13 +499,13 @@ export class Slides extends Ion {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
loopedSlides = null;
|
||||
loopedSlides: number = null;
|
||||
|
||||
// Swiping/no swiping
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
swipeHandler = null;
|
||||
swipeHandler: any = null;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ export function addRole(ele: HTMLElement, role: string) {
|
||||
ele.setAttribute('role', role);
|
||||
}
|
||||
|
||||
export function addLabel(ele: HTMLElement, label) {
|
||||
export function addLabel(ele: HTMLElement, label: string) {
|
||||
ele.setAttribute('aria-label', label);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import { updatePaginationClasses } from './swiper-pagination';
|
||||
Classes
|
||||
===========================*/
|
||||
export function updateClasses(s: Slides) {
|
||||
var childElements;
|
||||
var childElements: HTMLElement[];
|
||||
|
||||
removeClass(s._slides, [CLS.slideActive, CLS.slideNext, CLS.slidePrev, CLS.slideDuplicateActive, CLS.slideDuplicateNext, CLS.slideDuplicatePrev]);
|
||||
for (var i = 0; i < s._slides.length; i++) {
|
||||
|
@ -220,7 +220,7 @@ function updateClickedSlide(s: Slides, plt: Platform, e: SlideUIEvent) {
|
||||
|
||||
if (s.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s._activeIndex) {
|
||||
var slideToIndex = s.clickedIndex;
|
||||
var realIndex;
|
||||
var realIndex: number;
|
||||
var slidesPerView = s.slidesPerView === 'auto' ? currentSlidesPerView(s) : <number>s.slidesPerView;
|
||||
|
||||
if (s.loop) {
|
||||
@ -263,23 +263,27 @@ function updateClickedSlide(s: Slides, plt: Platform, e: SlideUIEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
var isTouched,
|
||||
isMoved,
|
||||
allowTouchCallbacks,
|
||||
touchStartTime,
|
||||
isScrolling,
|
||||
currentTranslate,
|
||||
startTranslate,
|
||||
allowThresholdMove,
|
||||
// Last click time
|
||||
lastClickTime = Date.now(), clickTimeout,
|
||||
// Velocities
|
||||
velocities = [],
|
||||
allowMomentumBounce;
|
||||
var isTouched: boolean;
|
||||
var isMoved: boolean;
|
||||
var allowTouchCallbacks: boolean;
|
||||
var touchStartTime: number;
|
||||
var isScrolling: boolean;
|
||||
var currentTranslate: number;
|
||||
var startTranslate: any;
|
||||
var allowThresholdMove: any;
|
||||
|
||||
// Last click time
|
||||
var lastClickTime = Date.now();
|
||||
var clickTimeout: any;
|
||||
|
||||
// Velocities
|
||||
var velocities: any[] = [];
|
||||
var allowMomentumBounce: boolean;
|
||||
|
||||
|
||||
// Touch handlers
|
||||
var isTouchEvent, startMoving;
|
||||
var isTouchEvent: boolean;
|
||||
var startMoving: boolean;
|
||||
|
||||
function onTouchStart(s: Slides, plt: Platform, ev: SlideUIEvent) {
|
||||
console.debug(`ion-slide, onTouchStart: ${ev.type}`);
|
||||
@ -408,7 +412,7 @@ function onTouchMove(s: Slides, plt: Platform, ev: SlideUIEvent) {
|
||||
s._touches.currentY = ev.type === 'touchmove' ? ev.targetTouches[0].pageY : ev.pageY;
|
||||
|
||||
if (typeof isScrolling === 'undefined') {
|
||||
var touchAngle;
|
||||
var touchAngle: number;
|
||||
if (isHorizontal(s) && s._touches.currentY === s._touches.startY || !isHorizontal(s) && s._touches.currentX === s._touches.startX) {
|
||||
isScrolling = false;
|
||||
} else {
|
||||
@ -516,12 +520,12 @@ function onTouchMove(s: Slides, plt: Platform, ev: SlideUIEvent) {
|
||||
// Velocity
|
||||
if (velocities.length === 0) {
|
||||
velocities.push({
|
||||
position: s._touches[isHorizontal(s) ? 'startX' : 'startY'],
|
||||
position: (<any>s._touches)[isHorizontal(s) ? 'startX' : 'startY'],
|
||||
time: touchStartTime
|
||||
});
|
||||
}
|
||||
velocities.push({
|
||||
position: s._touches[isHorizontal(s) ? 'currentX' : 'currentY'],
|
||||
position: (<any>s._touches)[isHorizontal(s) ? 'currentX' : 'currentY'],
|
||||
time: (new Date()).getTime()
|
||||
});
|
||||
}
|
||||
@ -592,7 +596,7 @@ function onTouchEnd(s: Slides, plt: Platform, ev: SlideUIEvent) {
|
||||
}
|
||||
isTouched = isMoved = false;
|
||||
|
||||
var currentPos;
|
||||
var currentPos: number;
|
||||
if (s.followFinger) {
|
||||
currentPos = s._rtl ? s._translate : -s._translate;
|
||||
} else {
|
||||
@ -642,7 +646,7 @@ function onTouchEnd(s: Slides, plt: Platform, ev: SlideUIEvent) {
|
||||
var newPosition = s._translate + momentumDistance;
|
||||
if (s._rtl) newPosition = - newPosition;
|
||||
var doBounce = false;
|
||||
var afterBouncePosition;
|
||||
var afterBouncePosition: number;
|
||||
var bounceAmount = Math.abs(s.velocity) * 20 * s.freeModeMomentumBounceRatio;
|
||||
|
||||
if (newPosition < maxTranslate(s)) {
|
||||
@ -670,8 +674,8 @@ function onTouchEnd(s: Slides, plt: Platform, ev: SlideUIEvent) {
|
||||
}
|
||||
|
||||
} else if (s.freeModeSticky) {
|
||||
var j = 0,
|
||||
nextSlide;
|
||||
var j = 0;
|
||||
var nextSlide: number;
|
||||
for (j = 0; j < s._snapGrid.length; j += 1) {
|
||||
if (s._snapGrid[j] > -newPosition) {
|
||||
nextSlide = j;
|
||||
|
@ -4,7 +4,10 @@ import { updateClasses } from './swiper-classes';
|
||||
|
||||
export function updateActiveIndex(s: Slides) {
|
||||
var translate = s._rtl ? s._translate : -s._translate;
|
||||
var newActiveIndex, i, snapIndex;
|
||||
var newActiveIndex: number;
|
||||
var i: number;
|
||||
var snapIndex: number;
|
||||
|
||||
for (i = 0; i < s._slidesGrid.length; i ++) {
|
||||
if (typeof s._slidesGrid[i + 1] !== 'undefined') {
|
||||
if (translate >= s._slidesGrid[i] && translate < s._slidesGrid[i + 1] - (s._slidesGrid[i + 1] - s._slidesGrid[i]) / 2) {
|
||||
|
@ -44,7 +44,7 @@ function handleKeyboard(s: Slides, plt: Platform, e: KeyboardEvent) {
|
||||
var swiperOffset = offset(s.container, plt);
|
||||
|
||||
if (s._rtl) {
|
||||
swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;
|
||||
swiperOffset.left = swiperOffset.left - s.container.scrollLeft;
|
||||
}
|
||||
|
||||
var swiperCoord = [
|
||||
|
@ -5,8 +5,10 @@ import { eachChild, isHorizontal, transform, transition } from './swiper-utils';
|
||||
/*=========================
|
||||
Parallax
|
||||
===========================*/
|
||||
function setParallaxTransform(s: Slides, el: HTMLElement, progress) {
|
||||
var p, pX, pY;
|
||||
function setParallaxTransform(s: Slides, el: HTMLElement, progress: number) {
|
||||
var p: string;
|
||||
var pX: string;
|
||||
var pY: string;
|
||||
var rtlFactor = s._rtl ? -1 : 1;
|
||||
|
||||
p = el.getAttribute('data-swiper-parallax') || '0';
|
||||
@ -30,13 +32,13 @@ function setParallaxTransform(s: Slides, el: HTMLElement, progress) {
|
||||
if ((pX).indexOf('%') >= 0) {
|
||||
pX = parseInt(pX, 10) * progress * rtlFactor + '%';
|
||||
} else {
|
||||
pX = pX * progress * rtlFactor + 'px' ;
|
||||
pX = <any>pX * progress * rtlFactor + 'px' ;
|
||||
}
|
||||
|
||||
if ((pY).indexOf('%') >= 0) {
|
||||
pY = parseInt(pY, 10) * progress + '%';
|
||||
} else {
|
||||
pY = pY * progress + 'px' ;
|
||||
pY = <any>pY * progress + 'px' ;
|
||||
}
|
||||
|
||||
transform(el, 'translate3d(' + pX + ', ' + pY + ',0px)');
|
||||
@ -51,7 +53,7 @@ export function parallaxSetTranslate(s: Slides) {
|
||||
for (var i = 0; i < s._slides.length; i++) {
|
||||
var slide = s._slides[i];
|
||||
eachChild(slide, '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]', (el) => {
|
||||
var progress = Math.min(Math.max(slide[0].progress, -1), 1);
|
||||
var progress = Math.min(Math.max(slide.progress, -1), 1);
|
||||
setParallaxTransform(s, slide, progress);
|
||||
});
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export function setWrapperTranslate(s: Slides, plt: Platform, translate: any, sh
|
||||
s._translate = isHorizontal(s) ? x : y;
|
||||
|
||||
// Check if we need to update progress
|
||||
var progress;
|
||||
var progress: number;
|
||||
var translatesDiff = maxTranslate(s) - minTranslate(s);
|
||||
|
||||
if (translatesDiff === 0) {
|
||||
@ -56,7 +56,10 @@ export function setWrapperTranslate(s: Slides, plt: Platform, translate: any, sh
|
||||
|
||||
export function getTranslate(s: Slides, plt: Platform, el: HTMLElement, axis: string) {
|
||||
var win: any = plt.win();
|
||||
var matrix, curTransform, curStyle, transformMatrix;
|
||||
var matrix: string[];
|
||||
var curTransform: any;
|
||||
var curStyle: CSSStyleDeclaration;
|
||||
var transformMatrix: any;
|
||||
|
||||
// automatic axis detection
|
||||
if (typeof axis === 'undefined') {
|
||||
@ -71,7 +74,7 @@ export function getTranslate(s: Slides, plt: Platform, el: HTMLElement, axis: st
|
||||
if (win.WebKitCSSMatrix) {
|
||||
curTransform = curStyle.transform || curStyle.webkitTransform;
|
||||
if (curTransform.split(',').length > 6) {
|
||||
curTransform = curTransform.split(', ').map(function(a){
|
||||
curTransform = curTransform.split(', ').map(function(a: any){
|
||||
return a.replace(',', '.');
|
||||
}).join(', ');
|
||||
}
|
||||
@ -80,14 +83,14 @@ export function getTranslate(s: Slides, plt: Platform, el: HTMLElement, axis: st
|
||||
transformMatrix = new win.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
|
||||
|
||||
} else {
|
||||
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
|
||||
transformMatrix = (<any>curStyle).MozTransform || (<any>curStyle).OTransform || (<any>curStyle).MsTransform || (<any>curStyle).msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
|
||||
matrix = transformMatrix.toString().split(',');
|
||||
}
|
||||
|
||||
if (axis === 'x') {
|
||||
if (win.WebKitCSSMatrix) {
|
||||
// Latest Chrome and webkits Fix
|
||||
curTransform = transformMatrix.m41;
|
||||
curTransform = <any>transformMatrix.m41;
|
||||
} else if (matrix.length === 16) {
|
||||
// Crazy IE10 Matrix
|
||||
curTransform = parseFloat(matrix[12]);
|
||||
|
@ -2,7 +2,7 @@ import { Slides } from '../slides';
|
||||
import { Platform } from '../../../platform/platform';
|
||||
|
||||
|
||||
export function round(a) {
|
||||
export function round(a: any) {
|
||||
return Math.floor(a);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ export function queryChildren(parentEle: HTMLElement, query: string): HTMLElemen
|
||||
return [];
|
||||
}
|
||||
|
||||
export function eachChild(parentEle: HTMLElement, query: string, callback: {(foundEle: HTMLElement)}): void {
|
||||
export function eachChild(parentEle: HTMLElement, query: string, callback: {(foundEle: HTMLElement): void}): void {
|
||||
if (parentEle) {
|
||||
var nodes = parentEle.querySelectorAll(query);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
|
@ -354,7 +354,24 @@ function toggleZoom(s: Slides, plt: Platform) {
|
||||
|
||||
if (!z.gesture.image) return;
|
||||
|
||||
var touchX, touchY, offsetX, offsetY, diffX, diffY, translateX, translateY, imageWidth, imageHeight, scaledWidth, scaledHeight, translateMinX, translateMinY, translateMaxX, translateMaxY, slideWidth, slideHeight;
|
||||
var touchX: number;
|
||||
var touchY: number;
|
||||
var offsetX: number;
|
||||
var offsetY: number;
|
||||
var diffX: number;
|
||||
var diffY: number;
|
||||
var translateX: number;
|
||||
var translateY: number;
|
||||
var imageWidth: number;
|
||||
var imageHeight: number;
|
||||
var scaledWidth: number;
|
||||
var scaledHeight: number;
|
||||
var translateMinX: number;
|
||||
var translateMinY: number;
|
||||
var translateMaxX: number;
|
||||
var translateMaxY: number;
|
||||
var slideWidth: number;
|
||||
var slideHeight: number;
|
||||
|
||||
if (typeof z.image.touchesStart.x === 'undefined' && ev) {
|
||||
touchX = ev.type === 'touchend' ? ev.changedTouches[0].pageX : (<any>ev).pageX;
|
||||
|
@ -290,9 +290,9 @@ export function pauseAutoplay(s: Slides, plt: Platform, speed?: number) {
|
||||
Slider/slides sizes
|
||||
===========================*/
|
||||
export function updateAutoHeight(s: Slides) {
|
||||
var activeSlides = [];
|
||||
var activeSlides: SlideElement[] = [];
|
||||
var newHeight = 0;
|
||||
var i;
|
||||
var i: number;
|
||||
|
||||
// Find slides currently in view
|
||||
if (s.slidesPerView !== 'auto' && s.slidesPerView > 1) {
|
||||
@ -378,7 +378,7 @@ export function updateSlidesSize(s: Slides, plt: Platform) {
|
||||
inlineStyle(s._slides, { marginRight: '', marginBottom: '' });
|
||||
}
|
||||
|
||||
var slidesNumberEvenToRows;
|
||||
var slidesNumberEvenToRows: number;
|
||||
if (s.slidesPerColumn > 1) {
|
||||
if (Math.floor(s._slides.length / s.slidesPerColumn) === s._slides.length / s.slidesPerColumn) {
|
||||
slidesNumberEvenToRows = s._slides.length;
|
||||
@ -401,8 +401,10 @@ export function updateSlidesSize(s: Slides, plt: Platform) {
|
||||
var slide = s._slides[i];
|
||||
if (s.slidesPerColumn > 1) {
|
||||
// Set slides order
|
||||
var newSlideOrderIndex;
|
||||
var column, row;
|
||||
var newSlideOrderIndex: number;
|
||||
var column: number;
|
||||
var row: number;
|
||||
|
||||
if (s.slidesPerColumnFill === 'column') {
|
||||
column = Math.floor(i / slidesPerColumn);
|
||||
row = i - column * slidesPerColumn;
|
||||
@ -427,7 +429,7 @@ export function updateSlidesSize(s: Slides, plt: Platform) {
|
||||
}
|
||||
|
||||
var cssVal = (row !== 0 && s.spaceBetween) && (s.spaceBetween + 'px');
|
||||
var cssObj = {};
|
||||
var cssObj: {[key: string]: string} = {};
|
||||
|
||||
if (isHorizontal(s)) {
|
||||
cssObj['marginTop'] = cssVal;
|
||||
@ -436,8 +438,8 @@ export function updateSlidesSize(s: Slides, plt: Platform) {
|
||||
}
|
||||
|
||||
inlineStyle(slide, cssObj);
|
||||
slide.setAttribute('data-swiper-column', column);
|
||||
slide.setAttribute('data-swiper-row', row);
|
||||
slide.setAttribute('data-swiper-column', <any>column);
|
||||
slide.setAttribute('data-swiper-row', <any>row);
|
||||
}
|
||||
|
||||
if (slide.style.display === 'none') {
|
||||
@ -487,7 +489,7 @@ export function updateSlidesSize(s: Slides, plt: Platform) {
|
||||
index ++;
|
||||
}
|
||||
s._virtualSize = Math.max(s._virtualSize, s._renderedSize) + s.slidesOffsetAfter;
|
||||
var newSlidesGrid;
|
||||
var newSlidesGrid: any[];
|
||||
|
||||
if (
|
||||
s._rtl && (s.effect === 'slide' || s.effect === 'coverflow')) {
|
||||
@ -554,10 +556,14 @@ export function updateSlidesSize(s: Slides, plt: Platform) {
|
||||
Dynamic Slides Per View
|
||||
===========================*/
|
||||
export function currentSlidesPerView(s: Slides) {
|
||||
var spv = 1, i, j;
|
||||
var spv = 1;
|
||||
var i: number;
|
||||
var j: number;
|
||||
|
||||
if (s.centeredSlides) {
|
||||
var size = s._slides[s._activeIndex].swiperSlideSize;
|
||||
var breakLoop;
|
||||
var breakLoop: boolean;
|
||||
|
||||
for (i = s._activeIndex + 1; i < s._slides.length; i++) {
|
||||
if (s._slides[i] && !breakLoop) {
|
||||
size += s._slides[i].swiperSlideSize;
|
||||
@ -565,6 +571,7 @@ export function currentSlidesPerView(s: Slides) {
|
||||
if (size > s._renderedSize) breakLoop = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (j = s._activeIndex - 1; j >= 0; j--) {
|
||||
if (s._slides[j] && !breakLoop) {
|
||||
size += s._slides[j].swiperSlideSize;
|
||||
@ -572,6 +579,7 @@ export function currentSlidesPerView(s: Slides) {
|
||||
if (size > s._renderedSize) breakLoop = true;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (i = s._activeIndex + 1; i < s._slides.length; i++) {
|
||||
if (s._slidesGrid[i] - s._slidesGrid[s._activeIndex] < s._renderedSize) {
|
||||
@ -599,7 +607,9 @@ export function update(s: Slides, plt: Platform, updateTranslate?: boolean) {
|
||||
resetZoomEvents(s, plt);
|
||||
}
|
||||
|
||||
var translated, newTranslate;
|
||||
var translated: boolean;
|
||||
var newTranslate: number;
|
||||
|
||||
function forceSetTranslate() {
|
||||
newTranslate = Math.min(Math.max(s._translate, maxTranslate(s)), minTranslate(s));
|
||||
setWrapperTranslate(s, plt, newTranslate);
|
||||
@ -654,8 +664,8 @@ function createLoop(s: Slides) {
|
||||
s.loopedSlides = slides.length;
|
||||
}
|
||||
|
||||
var prependSlides = [];
|
||||
var appendSlides = [];
|
||||
var prependSlides: SlideElement[] = [];
|
||||
var appendSlides: SlideElement[] = [];
|
||||
|
||||
for (var i = 0; i < slides.length; i++) {
|
||||
var slide = slides[i];
|
||||
@ -686,7 +696,8 @@ function destroyLoop(s: Slides) {
|
||||
}
|
||||
|
||||
export function fixLoop(s: Slides, plt: Platform) {
|
||||
var newIndex;
|
||||
var newIndex: number;
|
||||
|
||||
if (s._activeIndex < s.loopedSlides) {
|
||||
// Fix For Negative Oversliding
|
||||
newIndex = s._slides.length - s.loopedSlides * 3 + s._activeIndex;
|
||||
|
@ -26,7 +26,7 @@ var now = Date.now;
|
||||
* @param {Object} context
|
||||
* @returns {number}
|
||||
*/
|
||||
function setTimeoutContext(fn, timeout, context) {
|
||||
function setTimeoutContext(fn: any, timeout: any, context: any) {
|
||||
return setTimeout(bindFn(fn, context), timeout);
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ function setTimeoutContext(fn, timeout, context) {
|
||||
* @param {Object} [context]
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function invokeArrayArg(arg, fn, context) {
|
||||
function invokeArrayArg(arg: any, fn: any, context: any) {
|
||||
if (Array.isArray(arg)) {
|
||||
each(arg, context[fn], context);
|
||||
return true;
|
||||
@ -53,8 +53,8 @@ function invokeArrayArg(arg, fn, context) {
|
||||
* @param {Function} iterator
|
||||
* @param {Object} context
|
||||
*/
|
||||
function each(obj, iterator, context?) {
|
||||
var i;
|
||||
function each(obj: any, iterator: any, context?: any) {
|
||||
var i: any;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
@ -81,9 +81,9 @@ function each(obj, iterator, context?) {
|
||||
* @param {Function} base
|
||||
* @param {Object} [properties]
|
||||
*/
|
||||
function inherit(child, base, properties) {
|
||||
function inherit(child: any, base: any, properties: any) {
|
||||
var baseP = base.prototype,
|
||||
childP;
|
||||
childP: any;
|
||||
|
||||
childP = child.prototype = Object.create(baseP);
|
||||
childP.constructor = child;
|
||||
@ -100,7 +100,7 @@ function inherit(child, base, properties) {
|
||||
* @param {Object} context
|
||||
* @returns {Function}
|
||||
*/
|
||||
function bindFn(fn, context) {
|
||||
function bindFn(fn: any, context: any) {
|
||||
return function boundFn() {
|
||||
return fn.apply(context, arguments);
|
||||
};
|
||||
@ -113,7 +113,7 @@ function bindFn(fn, context) {
|
||||
* @param {Array} [args]
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function boolOrFn(val, args) {
|
||||
function boolOrFn(val: any, args: any) {
|
||||
if (typeof val == TYPE_FUNCTION) {
|
||||
return val.apply(args ? args[0] || undefined : undefined, args);
|
||||
}
|
||||
@ -126,7 +126,7 @@ function boolOrFn(val, args) {
|
||||
* @param {*} val2
|
||||
* @returns {*}
|
||||
*/
|
||||
function ifUndefined(val1, val2) {
|
||||
function ifUndefined(val1: any, val2: any) {
|
||||
return (val1 === undefined) ? val2 : val1;
|
||||
}
|
||||
|
||||
@ -136,8 +136,8 @@ function ifUndefined(val1, val2) {
|
||||
* @param {String} types
|
||||
* @param {Function} handler
|
||||
*/
|
||||
function addEventListeners(target, types, handler) {
|
||||
each(splitStr(types), function(type) {
|
||||
function addEventListeners(target: any, types: any, handler: any) {
|
||||
each(splitStr(types), function(type: any) {
|
||||
target.addEventListener(type, handler, false);
|
||||
});
|
||||
}
|
||||
@ -148,8 +148,8 @@ function addEventListeners(target, types, handler) {
|
||||
* @param {String} types
|
||||
* @param {Function} handler
|
||||
*/
|
||||
function removeEventListeners(target, types, handler) {
|
||||
each(splitStr(types), function(type) {
|
||||
function removeEventListeners(target: any, types: any, handler: any) {
|
||||
each(splitStr(types), function(type: any) {
|
||||
target.removeEventListener(type, handler, false);
|
||||
});
|
||||
}
|
||||
@ -161,7 +161,7 @@ function removeEventListeners(target, types, handler) {
|
||||
* @param {HTMLElement} parent
|
||||
* @return {Boolean} found
|
||||
*/
|
||||
function hasParent(node, parent) {
|
||||
function hasParent(node: any, parent: any) {
|
||||
while (node) {
|
||||
if (node == parent) {
|
||||
return true;
|
||||
@ -177,7 +177,7 @@ function hasParent(node, parent) {
|
||||
* @param {String} find
|
||||
* @returns {Boolean} found
|
||||
*/
|
||||
function inStr(str, find) {
|
||||
function inStr(str: any, find: any) {
|
||||
return str.indexOf(find) > -1;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ function inStr(str, find) {
|
||||
* @param {String} str
|
||||
* @returns {Array} words
|
||||
*/
|
||||
function splitStr(str) {
|
||||
function splitStr(str: any) {
|
||||
return str.trim().split(/\s+/g);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ function splitStr(str) {
|
||||
* @param {String} [findByKey]
|
||||
* @return {Boolean|Number} false when not found, or the index
|
||||
*/
|
||||
function inArray(src, find, findByKey?) {
|
||||
function inArray(src: any, find: any, findByKey?: any) {
|
||||
if (src.indexOf && !findByKey) {
|
||||
return src.indexOf(find);
|
||||
} else {
|
||||
@ -217,7 +217,7 @@ function inArray(src, find, findByKey?) {
|
||||
* @param {Object} obj
|
||||
* @returns {Array}
|
||||
*/
|
||||
function toArray(obj) {
|
||||
function toArray(obj: any) {
|
||||
return Array.prototype.slice.call(obj, 0);
|
||||
}
|
||||
|
||||
@ -228,9 +228,9 @@ function toArray(obj) {
|
||||
* @param {Boolean} [sort=False]
|
||||
* @returns {Array} [{id:1},{id:2}]
|
||||
*/
|
||||
function uniqueArray(src, key, sort) {
|
||||
var results = [];
|
||||
var values = [];
|
||||
function uniqueArray(src: any, key: any, sort: any) {
|
||||
var results: any = [];
|
||||
var values: any = [];
|
||||
var i = 0;
|
||||
|
||||
while (i < src.length) {
|
||||
@ -246,7 +246,7 @@ function uniqueArray(src, key, sort) {
|
||||
if (!key) {
|
||||
results = results.sort();
|
||||
} else {
|
||||
results = results.sort(function sortUniqueArray(a, b) {
|
||||
results = results.sort(function sortUniqueArray(a: any, b: any) {
|
||||
return a[key] > b[key] ? 1 : 0;
|
||||
});
|
||||
}
|
||||
@ -261,8 +261,8 @@ function uniqueArray(src, key, sort) {
|
||||
* @param {String} property
|
||||
* @returns {String|Undefined} prefixed
|
||||
*/
|
||||
function prefixed(obj, property) {
|
||||
var prefix, prop;
|
||||
function prefixed(obj: any, property: any) {
|
||||
var prefix: any, prop: any;
|
||||
var camelProp = property[0].toUpperCase() + property.slice(1);
|
||||
|
||||
var i = 0;
|
||||
@ -292,7 +292,7 @@ function uniqueId() {
|
||||
* @param {HTMLElement} element
|
||||
* @returns {DocumentView|Window}
|
||||
*/
|
||||
function getWindowForElement(element) {
|
||||
function getWindowForElement(element: any) {
|
||||
var doc = element.ownerDocument || element;
|
||||
return (doc.defaultView || doc.parentWindow || window);
|
||||
}
|
||||
@ -335,7 +335,7 @@ var PROPS_CLIENT_XY = ['clientX', 'clientY'];
|
||||
* @returns {Input}
|
||||
* @constructor
|
||||
*/
|
||||
function Input(manager, callback) {
|
||||
function Input(manager: any, callback: any) {
|
||||
var self = this;
|
||||
this.manager = manager;
|
||||
this.callback = callback;
|
||||
@ -344,7 +344,7 @@ function Input(manager, callback) {
|
||||
|
||||
// smaller wrapper around the handler, for the scope and the enabled state of the manager,
|
||||
// so when disabled the input events are completely bypassed.
|
||||
this.domHandler = function(ev) {
|
||||
this.domHandler = function(ev: any) {
|
||||
if (boolOrFn(manager.options.enable, [manager])) {
|
||||
self.handler(ev);
|
||||
}
|
||||
@ -386,8 +386,8 @@ Input.prototype = {
|
||||
* @param {Hammer} manager
|
||||
* @returns {Input}
|
||||
*/
|
||||
function createInputInstance(manager) {
|
||||
var Type;
|
||||
function createInputInstance(manager: any) {
|
||||
var Type: any;
|
||||
var inputClass = manager.options.inputClass;
|
||||
|
||||
if (inputClass) {
|
||||
@ -410,7 +410,7 @@ function createInputInstance(manager) {
|
||||
* @param {String} eventType
|
||||
* @param {Object} input
|
||||
*/
|
||||
function inputHandler(manager, eventType, input) {
|
||||
function inputHandler(manager: any, eventType: any, input: any) {
|
||||
var pointersLen = input.pointers.length;
|
||||
var changedPointersLen = input.changedPointers.length;
|
||||
var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
|
||||
@ -442,7 +442,7 @@ function inputHandler(manager, eventType, input) {
|
||||
* @param {Object} manager
|
||||
* @param {Object} input
|
||||
*/
|
||||
function computeInputData(manager, input) {
|
||||
function computeInputData(manager: any, input: any) {
|
||||
var session = manager.session;
|
||||
var pointers = input.pointers;
|
||||
var pointersLength = pointers.length;
|
||||
@ -494,7 +494,7 @@ function computeInputData(manager, input) {
|
||||
input.target = target;
|
||||
}
|
||||
|
||||
function computeDeltaXY(session, input) {
|
||||
function computeDeltaXY(session: any, input: any) {
|
||||
var center = input.center;
|
||||
var offset = session.offsetDelta || {};
|
||||
var prevDelta = session.prevDelta || {};
|
||||
@ -521,10 +521,10 @@ function computeDeltaXY(session, input) {
|
||||
* @param {Object} session
|
||||
* @param {Object} input
|
||||
*/
|
||||
function computeIntervalInputData(session, input) {
|
||||
function computeIntervalInputData(session: any, input: any) {
|
||||
var last = session.lastInterval || input,
|
||||
deltaTime = input.timeStamp - last.timeStamp,
|
||||
velocity, velocityX, velocityY, direction;
|
||||
velocity: any, velocityX: any, velocityY: any, direction: any;
|
||||
|
||||
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
|
||||
var deltaX = input.deltaX - last.deltaX;
|
||||
@ -556,10 +556,10 @@ function computeIntervalInputData(session, input) {
|
||||
* @param {Object} input
|
||||
* @returns {Object} clonedInputData
|
||||
*/
|
||||
function simpleCloneInputData(input) {
|
||||
function simpleCloneInputData(input: any) {
|
||||
// make a simple copy of the pointers because we will get a reference if we don't
|
||||
// we only need clientXY for the calculations
|
||||
var pointers = [];
|
||||
var pointers: any = [];
|
||||
var i = 0;
|
||||
while (i < input.pointers.length) {
|
||||
pointers[i] = {
|
||||
@ -583,7 +583,7 @@ function simpleCloneInputData(input) {
|
||||
* @param {Array} pointers
|
||||
* @return {Object} center contains `x` and `y` properties
|
||||
*/
|
||||
function getCenter(pointers) {
|
||||
function getCenter(pointers: any) {
|
||||
var pointersLength = pointers.length;
|
||||
|
||||
// no need to loop when only one touch
|
||||
@ -614,7 +614,7 @@ function getCenter(pointers) {
|
||||
* @param {Number} y
|
||||
* @return {Object} velocity `x` and `y`
|
||||
*/
|
||||
function getVelocity(deltaTime, x, y) {
|
||||
function getVelocity(deltaTime: any, x: any, y: any) {
|
||||
return {
|
||||
x: x / deltaTime || 0,
|
||||
y: y / deltaTime || 0
|
||||
@ -627,7 +627,7 @@ function getVelocity(deltaTime, x, y) {
|
||||
* @param {Number} y
|
||||
* @return {Number} direction
|
||||
*/
|
||||
function getDirection(x, y) {
|
||||
function getDirection(x: any, y: any) {
|
||||
if (x === y) {
|
||||
return DIRECTION_NONE;
|
||||
}
|
||||
@ -645,7 +645,7 @@ function getDirection(x, y) {
|
||||
* @param {Array} [props] containing x and y keys
|
||||
* @return {Number} distance
|
||||
*/
|
||||
function getDistance(p1, p2, props?) {
|
||||
function getDistance(p1: any, p2: any, props?: any) {
|
||||
if (!props) {
|
||||
props = PROPS_XY;
|
||||
}
|
||||
@ -662,7 +662,7 @@ function getDistance(p1, p2, props?) {
|
||||
* @param {Array} [props] containing x and y keys
|
||||
* @return {Number} angle
|
||||
*/
|
||||
function getAngle(p1, p2, props?) {
|
||||
function getAngle(p1: any, p2: any, props?: any) {
|
||||
if (!props) {
|
||||
props = PROPS_XY;
|
||||
}
|
||||
@ -677,7 +677,7 @@ function getAngle(p1, p2, props?) {
|
||||
* @param {Array} end array of pointers
|
||||
* @return {Number} rotation
|
||||
*/
|
||||
function getRotation(start, end) {
|
||||
function getRotation(start: any, end: any) {
|
||||
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
||||
}
|
||||
|
||||
@ -688,11 +688,11 @@ function getRotation(start, end) {
|
||||
* @param {Array} end array of pointers
|
||||
* @return {Number} scale
|
||||
*/
|
||||
function getScale(start, end) {
|
||||
function getScale(start: any, end: any) {
|
||||
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
|
||||
}
|
||||
|
||||
var MOUSE_INPUT_MAP = {
|
||||
var MOUSE_INPUT_MAP: any = {
|
||||
mousedown: INPUT_START,
|
||||
mousemove: INPUT_MOVE,
|
||||
mouseup: INPUT_END
|
||||
@ -721,7 +721,7 @@ inherit(MouseInput, Input, {
|
||||
* handle mouse events
|
||||
* @param {Object} ev
|
||||
*/
|
||||
handler: function MEhandler(ev) {
|
||||
handler: function MEhandler(ev: any) {
|
||||
var eventType = MOUSE_INPUT_MAP[ev.type];
|
||||
|
||||
// on start we want to have the left mouse button down
|
||||
@ -751,7 +751,7 @@ inherit(MouseInput, Input, {
|
||||
}
|
||||
});
|
||||
|
||||
var POINTER_INPUT_MAP = {
|
||||
var POINTER_INPUT_MAP: any = {
|
||||
pointerdown: INPUT_START,
|
||||
pointermove: INPUT_MOVE,
|
||||
pointerup: INPUT_END,
|
||||
@ -760,7 +760,7 @@ var POINTER_INPUT_MAP = {
|
||||
};
|
||||
|
||||
// in IE10 the pointer types is defined as an enum
|
||||
var IE10_POINTER_TYPE_ENUM = {
|
||||
var IE10_POINTER_TYPE_ENUM: any = {
|
||||
2: INPUT_TYPE_TOUCH,
|
||||
3: INPUT_TYPE_PEN,
|
||||
4: INPUT_TYPE_MOUSE,
|
||||
@ -795,7 +795,7 @@ inherit(PointerEventInput, Input, {
|
||||
* handle mouse events
|
||||
* @param {Object} ev
|
||||
*/
|
||||
handler: function PEhandler(ev) {
|
||||
handler: function PEhandler(ev: any) {
|
||||
var store = this.store;
|
||||
var removePointer = false;
|
||||
|
||||
@ -840,7 +840,7 @@ inherit(PointerEventInput, Input, {
|
||||
}
|
||||
});
|
||||
|
||||
var SINGLE_TOUCH_INPUT_MAP = {
|
||||
var SINGLE_TOUCH_INPUT_MAP: any = {
|
||||
touchstart: INPUT_START,
|
||||
touchmove: INPUT_MOVE,
|
||||
touchend: INPUT_END,
|
||||
@ -864,7 +864,7 @@ function SingleTouchInput() {
|
||||
}
|
||||
|
||||
inherit(SingleTouchInput, Input, {
|
||||
handler: function TEhandler(ev) {
|
||||
handler: function TEhandler(ev: any) {
|
||||
var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
|
||||
|
||||
// should we handle the touch events?
|
||||
@ -898,7 +898,7 @@ inherit(SingleTouchInput, Input, {
|
||||
* @param {Number} type flag
|
||||
* @returns {undefined|Array} [all, changed]
|
||||
*/
|
||||
function normalizeSingleTouches(ev, type) {
|
||||
function normalizeSingleTouches(ev: any, type: any) {
|
||||
var all = toArray(ev.touches);
|
||||
var changed = toArray(ev.changedTouches);
|
||||
|
||||
@ -909,7 +909,7 @@ function normalizeSingleTouches(ev, type) {
|
||||
return [all, changed];
|
||||
}
|
||||
|
||||
var TOUCH_INPUT_MAP = {
|
||||
var TOUCH_INPUT_MAP : any= {
|
||||
touchstart: INPUT_START,
|
||||
touchmove: INPUT_MOVE,
|
||||
touchend: INPUT_END,
|
||||
@ -923,7 +923,7 @@ var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
|
||||
* @constructor
|
||||
* @extends Input
|
||||
*/
|
||||
function TouchInput(manager: any, handler: any) {
|
||||
function TouchInput(manager: any, handler: any): void {
|
||||
this.evTarget = TOUCH_TARGET_EVENTS;
|
||||
this.targetIds = {};
|
||||
|
||||
@ -931,7 +931,7 @@ function TouchInput(manager: any, handler: any) {
|
||||
}
|
||||
|
||||
inherit(TouchInput, Input, {
|
||||
handler: function MTEhandler(ev) {
|
||||
handler: function MTEhandler(ev: any) {
|
||||
var type = TOUCH_INPUT_MAP[ev.type];
|
||||
var touches = getTouches.call(this, ev, type);
|
||||
if (!touches) {
|
||||
@ -953,7 +953,7 @@ inherit(TouchInput, Input, {
|
||||
* @param {Number} type flag
|
||||
* @returns {undefined|Array} [all, changed]
|
||||
*/
|
||||
function getTouches(ev, type) {
|
||||
function getTouches(ev: any, type: any) {
|
||||
var allTouches = toArray(ev.touches);
|
||||
var targetIds = this.targetIds;
|
||||
|
||||
@ -963,14 +963,14 @@ function getTouches(ev, type) {
|
||||
return [allTouches, allTouches];
|
||||
}
|
||||
|
||||
var i,
|
||||
targetTouches,
|
||||
var i: any,
|
||||
targetTouches: any,
|
||||
changedTouches = toArray(ev.changedTouches),
|
||||
changedTargetTouches = [],
|
||||
changedTargetTouches: any = [],
|
||||
target = this.target;
|
||||
|
||||
// get target touches from touches
|
||||
targetTouches = allTouches.filter(function(touch) {
|
||||
targetTouches = allTouches.filter(function(touch: any) {
|
||||
return hasParent(touch.target, target);
|
||||
});
|
||||
|
||||
@ -1017,12 +1017,12 @@ function getTouches(ev, type) {
|
||||
* @constructor
|
||||
* @extends Input
|
||||
*/
|
||||
function TouchMouseInput() {
|
||||
function TouchMouseInput(): void {
|
||||
Input.apply(this, arguments);
|
||||
|
||||
var handler = bindFn(this.handler, this);
|
||||
this.touch = new TouchInput(this.manager, handler);
|
||||
this.mouse = new MouseInput(this.manager, handler);
|
||||
this.touch = new (<any>TouchInput)(this.manager, handler);
|
||||
this.mouse = new (<any>MouseInput)(this.manager, handler);
|
||||
}
|
||||
|
||||
inherit(TouchMouseInput, Input, {
|
||||
@ -1032,7 +1032,7 @@ inherit(TouchMouseInput, Input, {
|
||||
* @param {String} inputEvent
|
||||
* @param {Object} inputData
|
||||
*/
|
||||
handler: function TMEhandler(manager, inputEvent, inputData) {
|
||||
handler: function TMEhandler(manager: any, inputEvent: any, inputData: any) {
|
||||
var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
|
||||
isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
|
||||
|
||||
@ -1079,7 +1079,7 @@ var TOUCH_ACTION_PAN_Y = 'pan-y';
|
||||
* @param {String} value
|
||||
* @constructor
|
||||
*/
|
||||
function TouchAction(manager, value) {
|
||||
function TouchAction(manager: any, value: any) {
|
||||
this.manager = manager;
|
||||
this.set(value);
|
||||
}
|
||||
@ -1089,7 +1089,7 @@ TouchAction.prototype = {
|
||||
* set the touchAction value on the element or enable the polyfill
|
||||
* @param {String} value
|
||||
*/
|
||||
set: function(value) {
|
||||
set: function(value: any) {
|
||||
// find out the touch-action by the event handlers
|
||||
if (value == TOUCH_ACTION_COMPUTE) {
|
||||
value = this.compute();
|
||||
@ -1113,8 +1113,8 @@ TouchAction.prototype = {
|
||||
* @returns {String} value
|
||||
*/
|
||||
compute: function() {
|
||||
var actions = [];
|
||||
each(this.manager.recognizers, function(recognizer) {
|
||||
var actions: any = [];
|
||||
each(this.manager.recognizers, function(recognizer: any) {
|
||||
if (boolOrFn(recognizer.options.enable, [recognizer])) {
|
||||
actions = actions.concat(recognizer.getTouchAction());
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ TouchAction.prototype = {
|
||||
* this method is called on each input cycle and provides the preventing of the browser behavior
|
||||
* @param {Object} input
|
||||
*/
|
||||
preventDefaults: function(input) {
|
||||
preventDefaults: function(input: any) {
|
||||
// not needed with native support for the touchAction property
|
||||
if (NATIVE_TOUCH_ACTION) {
|
||||
return;
|
||||
@ -1174,7 +1174,7 @@ TouchAction.prototype = {
|
||||
* call preventDefault to prevent the browser's default behavior (scrolling in most cases)
|
||||
* @param {Object} srcEvent
|
||||
*/
|
||||
preventSrc: function(srcEvent) {
|
||||
preventSrc: function(srcEvent: any) {
|
||||
this.manager.session.prevented = true;
|
||||
srcEvent.preventDefault();
|
||||
}
|
||||
@ -1185,7 +1185,7 @@ TouchAction.prototype = {
|
||||
* @param {String} actions
|
||||
* @returns {*}
|
||||
*/
|
||||
function cleanTouchActions(actions) {
|
||||
function cleanTouchActions(actions: any) {
|
||||
// none
|
||||
if (inStr(actions, TOUCH_ACTION_NONE)) {
|
||||
return TOUCH_ACTION_NONE;
|
||||
@ -1256,7 +1256,7 @@ var STATE_FAILED = 32;
|
||||
* @constructor
|
||||
* @param {Object} options
|
||||
*/
|
||||
function Recognizer(options) {
|
||||
function Recognizer(options: any) {
|
||||
this.options = Object.assign({}, this.defaults, options || {});
|
||||
|
||||
this.id = uniqueId();
|
||||
@ -1284,7 +1284,7 @@ Recognizer.prototype = {
|
||||
* @param {Object} options
|
||||
* @return {Recognizer}
|
||||
*/
|
||||
set: function(options) {
|
||||
set: function(options: any) {
|
||||
Object.assign(this.options, options);
|
||||
|
||||
// also update the touchAction, in case something changed about the directions/enabled state
|
||||
@ -1297,7 +1297,7 @@ Recognizer.prototype = {
|
||||
* @param {Recognizer} otherRecognizer
|
||||
* @returns {Recognizer} this
|
||||
*/
|
||||
recognizeWith: function(otherRecognizer) {
|
||||
recognizeWith: function(otherRecognizer: any) {
|
||||
if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
|
||||
return this;
|
||||
}
|
||||
@ -1316,7 +1316,7 @@ Recognizer.prototype = {
|
||||
* @param {Recognizer} otherRecognizer
|
||||
* @returns {Recognizer} this
|
||||
*/
|
||||
dropRecognizeWith: function(otherRecognizer) {
|
||||
dropRecognizeWith: function(otherRecognizer: any) {
|
||||
if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
|
||||
return this;
|
||||
}
|
||||
@ -1331,7 +1331,7 @@ Recognizer.prototype = {
|
||||
* @param {Recognizer} otherRecognizer
|
||||
* @returns {Recognizer} this
|
||||
*/
|
||||
requireFailure: function(otherRecognizer) {
|
||||
requireFailure: function(otherRecognizer: any) {
|
||||
if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
|
||||
return this;
|
||||
}
|
||||
@ -1350,7 +1350,7 @@ Recognizer.prototype = {
|
||||
* @param {Recognizer} otherRecognizer
|
||||
* @returns {Recognizer} this
|
||||
*/
|
||||
dropRequireFailure: function(otherRecognizer) {
|
||||
dropRequireFailure: function(otherRecognizer: any) {
|
||||
if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
|
||||
return this;
|
||||
}
|
||||
@ -1376,7 +1376,7 @@ Recognizer.prototype = {
|
||||
* @param {Recognizer} otherRecognizer
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
canRecognizeWith: function(otherRecognizer) {
|
||||
canRecognizeWith: function(otherRecognizer: any) {
|
||||
return !!this.simultaneous[otherRecognizer.id];
|
||||
},
|
||||
|
||||
@ -1385,11 +1385,11 @@ Recognizer.prototype = {
|
||||
* that all the needed recognizers has failed before emitting.
|
||||
* @param {Object} input
|
||||
*/
|
||||
emit: function(input) {
|
||||
emit: function(input: any) {
|
||||
var self = this;
|
||||
var state = this.state;
|
||||
|
||||
function emit(event) {
|
||||
function emit(event: any) {
|
||||
self.manager.emit(event, input);
|
||||
}
|
||||
|
||||
@ -1416,7 +1416,7 @@ Recognizer.prototype = {
|
||||
* otherwise, setup the state to FAILED.
|
||||
* @param {Object} input
|
||||
*/
|
||||
tryEmit: function(input) {
|
||||
tryEmit: function(input: any) {
|
||||
if (this.canEmit()) {
|
||||
return this.emit(input);
|
||||
}
|
||||
@ -1443,7 +1443,7 @@ Recognizer.prototype = {
|
||||
* update the recognizer
|
||||
* @param {Object} inputData
|
||||
*/
|
||||
recognize: function(inputData) {
|
||||
recognize: function(inputData: any) {
|
||||
// make a new copy of the inputData
|
||||
// so we can change the inputData without messing up the other recognizers
|
||||
var inputDataClone = Object.assign({}, inputData);
|
||||
@ -1476,7 +1476,7 @@ Recognizer.prototype = {
|
||||
* @param {Object} inputData
|
||||
* @returns {Const} STATE
|
||||
*/
|
||||
process: function(inputData) { }, // jshint ignore:line
|
||||
process: function(inputData: any) { }, // jshint ignore:line
|
||||
|
||||
/**
|
||||
* return the preferred touch-action
|
||||
@ -1498,7 +1498,7 @@ Recognizer.prototype = {
|
||||
* @param {Const} state
|
||||
* @returns {String} state
|
||||
*/
|
||||
function stateStr(state) {
|
||||
function stateStr(state: any) {
|
||||
if (state & STATE_CANCELLED) {
|
||||
return 'cancel';
|
||||
} else if (state & STATE_ENDED) {
|
||||
@ -1516,7 +1516,7 @@ function stateStr(state) {
|
||||
* @param {Const} direction
|
||||
* @returns {String}
|
||||
*/
|
||||
function directionStr(direction) {
|
||||
function directionStr(direction: any) {
|
||||
if (direction == DIRECTION_DOWN) {
|
||||
return 'down';
|
||||
} else if (direction == DIRECTION_UP) {
|
||||
@ -1535,7 +1535,7 @@ function directionStr(direction) {
|
||||
* @param {Recognizer} recognizer
|
||||
* @returns {Recognizer}
|
||||
*/
|
||||
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
|
||||
function getRecognizerByNameIfManager(otherRecognizer: any, recognizer: any) {
|
||||
var manager = recognizer.manager;
|
||||
if (manager) {
|
||||
return manager.get(otherRecognizer);
|
||||
@ -1571,7 +1571,7 @@ inherit(AttrRecognizer, Recognizer, {
|
||||
* @param {Object} input
|
||||
* @returns {Boolean} recognized
|
||||
*/
|
||||
attrTest: function(input) {
|
||||
attrTest: function(input: any) {
|
||||
var optionPointers = this.options.pointers;
|
||||
return optionPointers === 0 || input.pointers.length === optionPointers;
|
||||
},
|
||||
@ -1582,7 +1582,7 @@ inherit(AttrRecognizer, Recognizer, {
|
||||
* @param {Object} input
|
||||
* @returns {*} State
|
||||
*/
|
||||
process: function(input) {
|
||||
process: function(input: any) {
|
||||
var state = this.state;
|
||||
var eventType = input.eventType;
|
||||
|
||||
@ -1631,7 +1631,7 @@ inherit(PanRecognizer, AttrRecognizer, {
|
||||
|
||||
getTouchAction: function() {
|
||||
var direction = this.options.direction;
|
||||
var actions = [];
|
||||
var actions: any = [];
|
||||
if (direction & DIRECTION_HORIZONTAL) {
|
||||
actions.push(TOUCH_ACTION_PAN_Y);
|
||||
}
|
||||
@ -1641,7 +1641,7 @@ inherit(PanRecognizer, AttrRecognizer, {
|
||||
return actions;
|
||||
},
|
||||
|
||||
directionTest: function(input) {
|
||||
directionTest: function(input: any) {
|
||||
var options = this.options;
|
||||
var hasMoved = true;
|
||||
var distance = input.distance;
|
||||
@ -1665,12 +1665,12 @@ inherit(PanRecognizer, AttrRecognizer, {
|
||||
return hasMoved && distance > options.threshold && direction & options.direction;
|
||||
},
|
||||
|
||||
attrTest: function(input) {
|
||||
attrTest: function(input: any) {
|
||||
return AttrRecognizer.prototype.attrTest.call(this, input) &&
|
||||
(this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
|
||||
},
|
||||
|
||||
emit: function(input) {
|
||||
emit: function(input: any) {
|
||||
|
||||
this.pX = input.deltaX;
|
||||
this.pY = input.deltaY;
|
||||
@ -1709,12 +1709,12 @@ inherit(PinchRecognizer, AttrRecognizer, {
|
||||
return [TOUCH_ACTION_NONE];
|
||||
},
|
||||
|
||||
attrTest: function(input) {
|
||||
attrTest: function(input: any) {
|
||||
return this._super.attrTest.call(this, input) &&
|
||||
(Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
|
||||
},
|
||||
|
||||
emit: function(input) {
|
||||
emit: function(input: any) {
|
||||
if (input.scale !== 1) {
|
||||
var inOut = input.scale < 1 ? 'in' : 'out';
|
||||
input.additionalEvent = this.options.event + inOut;
|
||||
@ -1752,7 +1752,7 @@ inherit(PressRecognizer, Recognizer, {
|
||||
return [TOUCH_ACTION_AUTO];
|
||||
},
|
||||
|
||||
process: function(input) {
|
||||
process: function(input: any) {
|
||||
var options = this.options;
|
||||
var validPointers = input.pointers.length === options.pointers;
|
||||
var validMovement = input.distance < options.threshold;
|
||||
@ -1780,7 +1780,7 @@ inherit(PressRecognizer, Recognizer, {
|
||||
clearTimeout(this._timer);
|
||||
},
|
||||
|
||||
emit: function(input) {
|
||||
emit: function(input: any) {
|
||||
if (this.state !== STATE_RECOGNIZED) {
|
||||
return;
|
||||
}
|
||||
@ -1819,7 +1819,7 @@ inherit(RotateRecognizer, AttrRecognizer, {
|
||||
return [TOUCH_ACTION_NONE];
|
||||
},
|
||||
|
||||
attrTest: function(input) {
|
||||
attrTest: function(input: any) {
|
||||
return this._super.attrTest.call(this, input) &&
|
||||
(Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
|
||||
}
|
||||
@ -1852,9 +1852,9 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
||||
return PanRecognizer.prototype.getTouchAction.call(this);
|
||||
},
|
||||
|
||||
attrTest: function(input) {
|
||||
attrTest: function(input: any) {
|
||||
var direction = this.options.direction;
|
||||
var velocity;
|
||||
var velocity: any;
|
||||
|
||||
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
||||
velocity = input.overallVelocity;
|
||||
@ -1871,7 +1871,7 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
||||
abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
||||
},
|
||||
|
||||
emit: function(input) {
|
||||
emit: function(input: any) {
|
||||
var direction = directionStr(input.offsetDirection);
|
||||
if (direction) {
|
||||
this.manager.emit(this.options.event + direction, input);
|
||||
@ -1923,7 +1923,7 @@ inherit(TapRecognizer, Recognizer, {
|
||||
return [TOUCH_ACTION_MANIPULATION];
|
||||
},
|
||||
|
||||
process: function(input) {
|
||||
process: function(input: any) {
|
||||
var options = this.options;
|
||||
|
||||
var validPointers = input.pointers.length === options.pointers;
|
||||
@ -2002,10 +2002,10 @@ inherit(TapRecognizer, Recognizer, {
|
||||
* @param {Object} [options]
|
||||
* @constructor
|
||||
*/
|
||||
function Hammer(element, options) {
|
||||
function Hammer(element: any, options: any): any {
|
||||
options = options || {};
|
||||
options.recognizers = ifUndefined(options.recognizers, _defaults.preset);
|
||||
return new Manager(element, options);
|
||||
return new (<any>Manager)(element, options);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2017,7 +2017,7 @@ var VERSION = '2.0.6';
|
||||
* default settings
|
||||
* @namespace
|
||||
*/
|
||||
var _defaults = {
|
||||
var _defaults: any = {
|
||||
/**
|
||||
* set if DOM events are being triggered.
|
||||
* But this is slower and unused by simple implementations, so disabled by default.
|
||||
@ -2134,7 +2134,7 @@ var FORCED_STOP = 2;
|
||||
* @param {Object} [options]
|
||||
* @constructor
|
||||
*/
|
||||
function Manager(element, options) {
|
||||
function Manager(element: any, options: any) {
|
||||
this.options = Object.assign({}, _defaults, options || {});
|
||||
|
||||
this.options.inputTarget = this.options.inputTarget || element;
|
||||
@ -2145,11 +2145,11 @@ function Manager(element, options) {
|
||||
|
||||
this.element = element;
|
||||
this.input = createInputInstance(this);
|
||||
this.touchAction = new TouchAction(this, this.options.touchAction);
|
||||
this.touchAction = new (<any>TouchAction)(this, this.options.touchAction);
|
||||
|
||||
toggleCssProps(this, true);
|
||||
|
||||
each(this.options.recognizers, function(item) {
|
||||
each(this.options.recognizers, function(item: any) {
|
||||
var recognizer = this.add(new (item[0])(item[1]));
|
||||
item[2] && recognizer.recognizeWith(item[2]);
|
||||
item[3] && recognizer.requireFailure(item[3]);
|
||||
@ -2162,7 +2162,7 @@ Manager.prototype = {
|
||||
* @param {Object} options
|
||||
* @returns {Manager}
|
||||
*/
|
||||
set: function(options) {
|
||||
set: function(options: any) {
|
||||
Object.assign(this.options, options);
|
||||
|
||||
// Options that need a little more setup
|
||||
@ -2184,7 +2184,7 @@ Manager.prototype = {
|
||||
* When forced, the recognizer cycle is stopped immediately.
|
||||
* @param {Boolean} [force]
|
||||
*/
|
||||
stop: function(force) {
|
||||
stop: function(force: any) {
|
||||
this.session.stopped = force ? FORCED_STOP : STOP;
|
||||
},
|
||||
|
||||
@ -2194,7 +2194,7 @@ Manager.prototype = {
|
||||
* it walks through all the recognizers and tries to detect the gesture that is being made
|
||||
* @param {Object} inputData
|
||||
*/
|
||||
recognize: function(inputData) {
|
||||
recognize: function(inputData: any) {
|
||||
var session = this.session;
|
||||
if (session.stopped) {
|
||||
return;
|
||||
@ -2203,7 +2203,7 @@ Manager.prototype = {
|
||||
// run the touch-action polyfill
|
||||
this.touchAction.preventDefaults(inputData);
|
||||
|
||||
var recognizer;
|
||||
var recognizer: any;
|
||||
var recognizers = this.recognizers;
|
||||
|
||||
// this holds the recognizer that is being recognized.
|
||||
@ -2249,7 +2249,7 @@ Manager.prototype = {
|
||||
* @param {Recognizer|String} recognizer
|
||||
* @returns {Recognizer|Null}
|
||||
*/
|
||||
get: function(recognizer) {
|
||||
get: function(recognizer: any) {
|
||||
if (recognizer instanceof Recognizer) {
|
||||
return recognizer;
|
||||
}
|
||||
@ -2269,7 +2269,7 @@ Manager.prototype = {
|
||||
* @param {Recognizer} recognizer
|
||||
* @returns {Recognizer|Manager}
|
||||
*/
|
||||
add: function(recognizer) {
|
||||
add: function(recognizer: any) {
|
||||
if (invokeArrayArg(recognizer, 'add', this)) {
|
||||
return this;
|
||||
}
|
||||
@ -2292,7 +2292,7 @@ Manager.prototype = {
|
||||
* @param {Recognizer|String} recognizer
|
||||
* @returns {Manager}
|
||||
*/
|
||||
remove: function(recognizer) {
|
||||
remove: function(recognizer: any) {
|
||||
if (invokeArrayArg(recognizer, 'remove', this)) {
|
||||
return this;
|
||||
}
|
||||
@ -2319,9 +2319,9 @@ Manager.prototype = {
|
||||
* @param {Function} handler
|
||||
* @returns {EventEmitter} this
|
||||
*/
|
||||
on: function(events, handler) {
|
||||
on: function(events: any, handler: any) {
|
||||
var handlers = this.handlers;
|
||||
each(splitStr(events), function(event) {
|
||||
each(splitStr(events), function(event: any) {
|
||||
handlers[event] = handlers[event] || [];
|
||||
handlers[event].push(handler);
|
||||
});
|
||||
@ -2334,9 +2334,9 @@ Manager.prototype = {
|
||||
* @param {Function} [handler]
|
||||
* @returns {EventEmitter} this
|
||||
*/
|
||||
off: function(events, handler) {
|
||||
off: function(events: any, handler: any) {
|
||||
var handlers = this.handlers;
|
||||
each(splitStr(events), function(event) {
|
||||
each(splitStr(events), function(event: any) {
|
||||
if (!handler) {
|
||||
delete handlers[event];
|
||||
} else {
|
||||
@ -2351,7 +2351,7 @@ Manager.prototype = {
|
||||
* @param {String} event
|
||||
* @param {Object} data
|
||||
*/
|
||||
emit: function(event, data) {
|
||||
emit: function(event: any, data: any) {
|
||||
// we also want to trigger dom events
|
||||
if (this.options.domEvents) {
|
||||
triggerDomEvent(event, data);
|
||||
@ -2394,12 +2394,12 @@ Manager.prototype = {
|
||||
* @param {Manager} manager
|
||||
* @param {Boolean} add
|
||||
*/
|
||||
function toggleCssProps(manager, add) {
|
||||
function toggleCssProps(manager: any, add: any) {
|
||||
var element = manager.element;
|
||||
if (!element.style) {
|
||||
return;
|
||||
}
|
||||
each(manager.options.cssProps, function(value, name) {
|
||||
each(manager.options.cssProps, function(value: any, name: any) {
|
||||
element.style[prefixed(element.style, name)] = add ? value : '';
|
||||
});
|
||||
}
|
||||
@ -2409,7 +2409,7 @@ function toggleCssProps(manager, add) {
|
||||
* @param {String} event
|
||||
* @param {Object} data
|
||||
*/
|
||||
function triggerDomEvent(event, data) {
|
||||
function triggerDomEvent(event: any, data: any) {
|
||||
var gestureEvent: any = doc.createEvent('Event');
|
||||
gestureEvent.initEvent(event, true, true);
|
||||
gestureEvent.gesture = data;
|
||||
|
@ -608,5 +608,5 @@ export abstract class NavController {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
abstract registerChildNav(nav: any);
|
||||
abstract registerChildNav(nav: any): void;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ describe('ViewController', () => {
|
||||
it('should emit LifeCycleEvent when called with component data', (done) => {
|
||||
// arrange
|
||||
let viewController = mockView();
|
||||
subscription = viewController.willEnter.subscribe((event) => {
|
||||
subscription = viewController.willEnter.subscribe((event: any) => {
|
||||
// assert
|
||||
expect(event).toEqual(null);
|
||||
done();
|
||||
@ -24,7 +24,7 @@ describe('ViewController', () => {
|
||||
it('should emit LifeCycleEvent when called with component data', (done) => {
|
||||
// arrange
|
||||
let viewController = mockView();
|
||||
subscription = viewController.didEnter.subscribe((event) => {
|
||||
subscription = viewController.didEnter.subscribe((event: any) => {
|
||||
// assert
|
||||
expect(event).toEqual(null);
|
||||
done();
|
||||
@ -41,7 +41,7 @@ describe('ViewController', () => {
|
||||
it('should emit LifeCycleEvent when called with component data', (done) => {
|
||||
// arrange
|
||||
let viewController = mockView();
|
||||
subscription = viewController.willLeave.subscribe((event) => {
|
||||
subscription = viewController.willLeave.subscribe((event: any) => {
|
||||
// assert
|
||||
expect(event).toEqual(null);
|
||||
done();
|
||||
@ -58,7 +58,7 @@ describe('ViewController', () => {
|
||||
it('should emit LifeCycleEvent when called with component data', (done) => {
|
||||
// arrange
|
||||
let viewController = mockView();
|
||||
subscription = viewController.didLeave.subscribe((event) => {
|
||||
subscription = viewController.didLeave.subscribe((event: any) => {
|
||||
// assert
|
||||
expect(event).toEqual(null);
|
||||
done();
|
||||
@ -75,7 +75,7 @@ describe('ViewController', () => {
|
||||
it('should emit LifeCycleEvent when called with component data', (done) => {
|
||||
// arrange
|
||||
let viewController = mockView();
|
||||
subscription = viewController.willUnload.subscribe((event) => {
|
||||
subscription = viewController.willUnload.subscribe((event: any) => {
|
||||
expect(event).toEqual(null);
|
||||
done();
|
||||
}, (err: any) => {
|
||||
|
@ -162,7 +162,7 @@ export class Keyboard {
|
||||
|
||||
function cssClass() {
|
||||
self._dom.write(() => {
|
||||
platform.doc().body.classList[isKeyInputEnabled ? 'add' : 'remove']('focus-outline');
|
||||
(<any>platform.doc().body.classList)[isKeyInputEnabled ? 'add' : 'remove']('focus-outline');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ export const PLATFORM_CONFIGS: { [key: string]: PlatformConfig } = {
|
||||
|
||||
// cordova has its own exitApp method
|
||||
plt.exitApp = function() {
|
||||
win['navigator']['app'].exitApp();
|
||||
(<any>win)['navigator']['app'].exitApp();
|
||||
};
|
||||
|
||||
// cordova has fully loaded and we've added listeners
|
||||
|
@ -20,7 +20,7 @@ export function isSafari(plt: Platform): boolean {
|
||||
|
||||
|
||||
export function isWKWebView(plt: Platform): boolean {
|
||||
return isIos(plt) && !!plt.win()['webkit'];
|
||||
return isIos(plt) && !!(<any>plt.win())['webkit'];
|
||||
}
|
||||
|
||||
export function isIosUIWebView(plt: Platform): boolean {
|
||||
|
@ -1175,8 +1175,8 @@ export function setupPlatform(doc: HTMLDocument, platformConfigs: {[key: string]
|
||||
plt.init();
|
||||
|
||||
// add the platform obj to the window
|
||||
win['Ionic'] = win['Ionic'] || {};
|
||||
win['Ionic']['platform'] = plt;
|
||||
(<any>win)['Ionic'] = (<any>win)['Ionic'] || {};
|
||||
(<any>win)['Ionic']['platform'] = plt;
|
||||
|
||||
return plt;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ export class Activator implements ActivatorBase {
|
||||
let ele: HTMLElement;
|
||||
for (var i = 0; i < this._active.length; i++) {
|
||||
ele = this._active[i];
|
||||
ele.style[this.dom.plt.Css.transition] = animated ? '' : 'none';
|
||||
(<any>ele.style)[this.dom.plt.Css.transition] = animated ? '' : 'none';
|
||||
ele.classList.remove(this._css);
|
||||
}
|
||||
this._active.length = 0;
|
||||
|
@ -120,7 +120,7 @@ describe('Activator', () => {
|
||||
|
||||
});
|
||||
|
||||
function testValues() {
|
||||
function testValues(): any {
|
||||
let parent = document.createElement('div');
|
||||
let ele = document.createElement('a');
|
||||
parent.appendChild(ele);
|
||||
|
@ -11,9 +11,9 @@ export function renderDateTime(template: string, value: DateTimeData, locale: Lo
|
||||
FORMAT_KEYS.forEach((format, index) => {
|
||||
if (template.indexOf(format.f) > -1) {
|
||||
var token = '{' + index + '}';
|
||||
var text = renderTextFormat(format.f, value[format.k], value, locale);
|
||||
var text = renderTextFormat(format.f, (<any>value)[format.k], value, locale);
|
||||
|
||||
if (!hasText && text && isPresent(value[format.k])) {
|
||||
if (!hasText && text && isPresent((<any>value)[format.k])) {
|
||||
hasText = true;
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ export function updateDate(existingData: DateTimeData, newData: any) {
|
||||
// merge new values from the picker's selection
|
||||
// to the existing DateTimeData values
|
||||
for (var k in newData) {
|
||||
existingData[k] = newData[k].value;
|
||||
(<any>existingData)[k] = newData[k].value;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -271,7 +271,7 @@ export function updateDate(existingData: DateTimeData, newData: any) {
|
||||
} else {
|
||||
// blank data, clear everything out
|
||||
for (var k in existingData) {
|
||||
delete existingData[k];
|
||||
delete (<any>existingData)[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -318,7 +318,7 @@ export function getValueFromFormat(date: DateTimeData, format: string) {
|
||||
if (format === FORMAT_hh || format === FORMAT_h) {
|
||||
return (date.hour > 12 ? date.hour - 12 : date.hour);
|
||||
}
|
||||
return date[convertFormatToKey(format)];
|
||||
return (<any>date)[convertFormatToKey(format)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ export function getCss(docEle: HTMLElement) {
|
||||
var keys = ['webkitTransform', '-webkit-transform', 'webkit-transform', 'transform'];
|
||||
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
if (docEle.style[keys[i]] !== undefined) {
|
||||
if ((<any>docEle.style)[keys[i]] !== undefined) {
|
||||
css.transform = keys[i];
|
||||
break;
|
||||
}
|
||||
@ -26,7 +26,7 @@ export function getCss(docEle: HTMLElement) {
|
||||
// transition
|
||||
keys = ['webkitTransition', 'transition'];
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
if (docEle.style[keys[i]] !== undefined) {
|
||||
if ((<any>docEle.style)[keys[i]] !== undefined) {
|
||||
css.transition = keys[i];
|
||||
break;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import { ScrollView } from '../util/scroll-view';
|
||||
* @demo /docs/v2/demos/src/events/
|
||||
*/
|
||||
export class Events {
|
||||
private _channels: Array<any> = [];
|
||||
private _channels: any = [];
|
||||
|
||||
/**
|
||||
* Subscribe to an event topic. Events that get posted to that topic will trigger the provided handler.
|
||||
|
@ -50,7 +50,7 @@ export class IonicErrorHandler extends ErrorHandler {
|
||||
handleError(err: any): void {
|
||||
super.handleError(err);
|
||||
try {
|
||||
const devServer = window['IonicDevServer'];
|
||||
const devServer = (<any>window)['IonicDevServer'];
|
||||
if (devServer) {
|
||||
devServer.handleError(err);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ export class MockPlatform extends Platform {
|
||||
return 0;
|
||||
});
|
||||
|
||||
const keepers = [];
|
||||
const keepers: any[] = [];
|
||||
this.timeouts.forEach(t => {
|
||||
if (t.timeout < timeout) {
|
||||
t.callback();
|
||||
@ -160,7 +160,7 @@ export class MockDomController extends DomController {
|
||||
|
||||
flush(done: any) {
|
||||
this.mockedPlatform.flushTimeouts(() => {
|
||||
this.mockedPlatform.flushRafs(timeStamp => {
|
||||
this.mockedPlatform.flushRafs((timeStamp: number) => {
|
||||
done(timeStamp);
|
||||
});
|
||||
});
|
||||
@ -168,7 +168,7 @@ export class MockDomController extends DomController {
|
||||
|
||||
flushUntil(timeout: number, done: any) {
|
||||
this.mockedPlatform.flushTimeoutsUntil(timeout, () => {
|
||||
this.mockedPlatform.flushRafs(timeStamp => {
|
||||
this.mockedPlatform.flushRafs((timeStamp: number) => {
|
||||
done(timeStamp);
|
||||
});
|
||||
});
|
||||
|
@ -125,8 +125,8 @@ describe('mock-providers', () => {
|
||||
it('should set rafs', (done) => {
|
||||
let callOrder: number[] = [];
|
||||
let timestamps: number[] = [];
|
||||
let callback1 = (timeStamp) => { callOrder.push(1); timestamps.push(timeStamp); };
|
||||
let callback2 = (timeStamp) => { callOrder.push(2); timestamps.push(timeStamp); };
|
||||
let callback1 = (timeStamp: number) => { callOrder.push(1); timestamps.push(timeStamp); };
|
||||
let callback2 = (timeStamp: number) => { callOrder.push(2); timestamps.push(timeStamp); };
|
||||
|
||||
plt.raf(callback1);
|
||||
plt.raf(callback2);
|
||||
|
@ -7,7 +7,7 @@
|
||||
"lib": ["dom", "es2015"],
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": false,
|
||||
"noImplicitAny": true,
|
||||
"removeComments": false,
|
||||
"sourceMap": true,
|
||||
"target": "es5",
|
||||
|
Reference in New Issue
Block a user