forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular-scroll-tests.ts
More file actions
64 lines (49 loc) · 3.5 KB
/
angular-scroll-tests.ts
File metadata and controls
64 lines (49 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/// <reference path="angular-scroll.d.ts" />
module TestApp {
class TestController {
constructor($scope: ng.IScope, $document: duScroll.IDocumentService) {
var positionFromTop = 400;
var positionFromLeft = 200;
var offsetInPixels = 100;
var durationInMillis = 2000;
var someElement: ng.IAugmentedJQuery;
$document.duScrollTo(positionFromLeft, positionFromTop);
$document.duScrollTo(positionFromLeft, positionFromTop, durationInMillis).then(this.onScrollCompleted);
$document.duScrollTo(positionFromLeft, positionFromTop, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
$document.duScrollTo(someElement);
$document.duScrollTo(someElement, offsetInPixels);
$document.duScrollTo(someElement, offsetInPixels, durationInMillis).then(this.onScrollCompleted);
$document.duScrollTo(someElement, offsetInPixels, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
$document.duScrollToElement(someElement);
$document.duScrollToElement(someElement, offsetInPixels);
$document.duScrollToElement(someElement, offsetInPixels, durationInMillis).then(this.onScrollCompleted);
$document.duScrollToElement(someElement, offsetInPixels, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
$document.duScrollToElementAnimated(someElement).then(this.onScrollCompleted);
$document.duScrollToElementAnimated(someElement, offsetInPixels).then(this.onScrollCompleted);
$document.duScrollToElementAnimated(someElement, offsetInPixels, durationInMillis).then(this.onScrollCompleted);
$document.duScrollToElementAnimated(someElement, offsetInPixels, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
$document.duScrollTop(positionFromTop);
$document.duScrollTop(positionFromTop, durationInMillis).then(this.onScrollCompleted);
$document.duScrollTop(positionFromTop, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
$document.duScrollTopAnimated(positionFromTop).then(this.onScrollCompleted);
$document.duScrollTopAnimated(positionFromTop, durationInMillis).then(this.onScrollCompleted);
$document.duScrollTopAnimated(positionFromTop, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
$document.duScrollLeft(positionFromLeft);
$document.duScrollLeft(positionFromLeft, durationInMillis).then(this.onScrollCompleted);
$document.duScrollLeft(positionFromLeft, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
$document.duScrollLeftAnimated(positionFromLeft).then(this.onScrollCompleted);
$document.duScrollLeftAnimated(positionFromLeft, durationInMillis).then(this.onScrollCompleted);
$document.duScrollLeftAnimated(positionFromLeft, durationInMillis, this.invertedEasingFn).then(this.onScrollCompleted);
var verticalPosition: number = $document.duScrollTop();
var horixontalPosition: number = $document.duScrollLeft();
}
private invertedEasingFn = (x: number): number => {
return 1 - x;
}
private onScrollCompleted = (): void => {
console.log('Done scrolling');
}
}
angular.module('testApp', ['duScroll'])
.controller('testController', TestController);
}