forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'handleExtraObjectLiteralProperties' of https://github.c…
…om/DanielRosenwasser/DefinitelyTyped into handleExtraObjectLiteralProperties
- Loading branch information
Showing
150 changed files
with
33,763 additions
and
5,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/// <reference path="angular-ui-scroll.d.ts" /> | ||
var myApp = angular.module('application', ['ui.scroll', 'ui.scroll.jqlite']); | ||
|
||
module application { | ||
interface IItem { | ||
id: number; | ||
content: string; | ||
} | ||
|
||
class DatasourceTest implements ng.ui.IScrollDatasource<IItem> { | ||
get(index: number, count: number, success: (results: IItem[]) => void): void { | ||
var ret = new Array<IItem>(); | ||
for (var i=0; i < count; i++) { | ||
ret.push({id: i, content: 'item ' + i.toString()}); | ||
} | ||
success(ret); | ||
} | ||
} | ||
|
||
function factory(): any { | ||
return DatasourceTest; | ||
} | ||
|
||
myApp.factory('DatasourceTest', factory); | ||
|
||
// demo/examples/adapter | ||
myApp.controller('mainController', ['$scope', 'DatasourceTest', function($scope: ng.IScope, datasource: DatasourceTest) { | ||
var firstListAdapter: ng.ui.IScrollAdapter, secondListAdapter: ng.ui.IScrollAdapter; | ||
$scope['datasource'] = datasource; | ||
|
||
$scope['updateList1'] = (): void => { | ||
firstListAdapter.applyUpdates( (item: IItem, scope: ng.IRepeatScope) => { | ||
return item.content += ' *'; | ||
}) | ||
}; | ||
|
||
$scope['removeFromList1'] = (): void => { | ||
firstListAdapter.applyUpdates( (item: IItem, scope: ng.IRepeatScope) => { | ||
if (scope.$index % 2 === 0) { | ||
return [] | ||
} | ||
}) | ||
}; | ||
|
||
var idList1: number = 1000; | ||
$scope['addToList1'] = (): void => { | ||
firstListAdapter.applyUpdates((item: IItem, scope: ng.IRepeatScope) => { | ||
var newItem: IItem; | ||
newItem = void 0; | ||
if (scope.$index === 2) { | ||
newItem = { | ||
id: idList1, | ||
content: 'a new one #' + idList1 | ||
}; | ||
idList1++; | ||
return [item, newItem]; | ||
} | ||
}); | ||
}; | ||
|
||
$scope['updateList2'] = (): void => { | ||
secondListAdapter.applyUpdates((item: IItem, scope: ng.IRepeatScope) => { | ||
return item.content += ' *'; | ||
}); | ||
}; | ||
|
||
$scope['removeFromList2'] = (): void => { | ||
secondListAdapter.applyUpdates((item: IItem, scope: ng.IRepeatScope) => { | ||
if (scope.$index % 2 !== 0) { | ||
return []; | ||
} | ||
}); | ||
}; | ||
|
||
var idList2: number = 2000; | ||
$scope['addToList2'] = (): void => { | ||
secondListAdapter.applyUpdates((item: IItem, scope: ng.IRepeatScope) => { | ||
var newItem: IItem; | ||
newItem = void 0; | ||
if (scope.$index === 4) { | ||
newItem = { | ||
id: idList2, | ||
content: 'a new one #' + idList1 | ||
}; | ||
idList2++; | ||
return [item, newItem]; | ||
} | ||
}); | ||
}; | ||
|
||
}]); | ||
} | ||
|
Oops, something went wrong.