Skip to content

Commit f9654c9

Browse files
committed
memory leakes demo
1 parent a377c8d commit f9654c9

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

demo/rebuilding/rebuilding.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Rebuilding</title>
6+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
7+
<script src="../../dist/ui-scroll.js"></script>
8+
<script src="../../dist/ui-scroll-jqlite.js"></script>
9+
<script src="rebuilding.js" ></script>
10+
<link rel="stylesheet" href="../css/style.css" type="text/css"/>
11+
</head>
12+
<body ng-controller="mainController" ng-app="application">
13+
14+
<div class="cont cont-global">
15+
16+
<a class="back" href="../index.html">browse other examples</a>
17+
18+
<h1 class="page-header page-header-exapmle">Multiple component rebuild</h1>
19+
20+
<div class="description">
21+
This demo allows to trace memory leaks during destroy and rebuild ui-scroll component.
22+
</div>
23+
24+
<div class="actions">
25+
<div class="checkbox">
26+
<label>
27+
<button ng-click="switch = !switch"> {{switch ? 'Destroy' : 'Build'}} </button>
28+
</label>
29+
</div>
30+
</div>
31+
32+
<div ng-if="switch">
33+
<div class="viewport" id="viewport-scopeDatasource" ui-scroll-viewport>
34+
<div class="item" ui-scroll="item in datasource">{{item}}</div>
35+
</div>
36+
</div>
37+
38+
</div>
39+
40+
</body>
41+
</html>

demo/rebuilding/rebuilding.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite'])
2+
.controller('mainController', [
3+
'$scope', '$log', '$timeout', function ($scope, console, $timeout) {
4+
var datasource = {};
5+
6+
datasource.get = function (index, count, success) {
7+
$timeout(function () {
8+
var result = [];
9+
for (var i = index; i <= index + count - 1; i++) {
10+
result.push("item #" + i);
11+
}
12+
success(result);
13+
}, 100);
14+
};
15+
16+
$scope.datasource = datasource;
17+
18+
$scope.switch = false;
19+
}
20+
]);

0 commit comments

Comments
 (0)