本文整理汇总了TypeScript中data/observable-array.ObservableArray类的典型用法代码示例。如果您正苦于以下问题:TypeScript ObservableArray类的具体用法?TypeScript ObservableArray怎么用?TypeScript ObservableArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObservableArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getPersons
private getPersons() : ObservableArray<Person> {
var data = new ObservableArray<Person>();
for (var i = 0; i < 30; i++) {
if(i % 2 == 0)
{
data.push(new Person(i, "John Doe ", false));
}
else
{
data.push(new Person(i, "Jessica Donovan", true));
}
}
return data;
}
示例2: initDataItems
private initDataItems() {
this._items = new ObservableArray<DataItem>();
for (var i = 0; i < 25; i++) {
this._items.push(new DataItem(i, "Item " + i, "This is item description."));
}
}
示例3: initDataItems
private initDataItems() {
if (!this._dataItems) {
this._dataItems = new ObservableArray<DataItem>();
for (var i = 1; i <= 50; i++) {
this._dataItems.push(new DataItem(i, "http://lorempixel.com/400/200/"));
}
}
}
示例4: clear
public clear() {
this._notifications.length = 0;
this._notifications.notify({
eventName: ObservableArray.changeEvent,
object: this._notifications
});
this.serialize();
}
示例5: onSubmit
public onSubmit(value) {
this.myItems = new ObservableArray<DataItem>();
let searchValue = value.toLowerCase();
if (value !== "") {
for (let i = 0; i < this.arrayItems.length; i++) {
if (this.arrayItems[i].name.toLowerCase().indexOf(searchValue) !== -1) {
this.myItems.push(this.arrayItems[i]);
}
}
}
}
示例6: Session
return new Promise<ObservableArray<Session>>((resolve, reject) => {
let sessions = new ObservableArray<Session>([]);
try {
FileReader.readJSON('data/sessions.json').then((content: Array<Object>) => {
content.forEach((item: any) => {
let speaker = SpeakerService.GetSpeaker(item.speakerId).then((speaker) => {
sessions.push(new Session(item.sessionName, item.sessionDesc, item.location, speaker));
});
});
resolve(sessions);
});
}
catch (err) {
reject(err);
}
});
示例7: ObservableArray
import { ObservableArray } from "data/observable-array";
import { CoinViewModel } from "./coin-view-model";
export var allCoinsViewModel = new ObservableArray();
allCoinsViewModel.push(new CoinViewModel("2 Stotinki", "1881", 2.0, 18, "Copper", "https://www.sixbid.com/images/auction_images/1186/1096532m.jpg", 1500000));
allCoinsViewModel.push(new CoinViewModel("5 Stotinki", "1881", 5.0, 23, "Copper", null, 5000000));
allCoinsViewModel.push(new CoinViewModel("10 Stotinki", "1881", 10.0, 27, "Copper", "http://coinquest.com/cgi-data/cq_ro/response_380/bulgaria_10_stotinki_1881.jpg", 10000000));
allCoinsViewModel.push(new CoinViewModel("2 Leva", "1882", 10.0, 24, "Silver", "http://www.coinfactswiki.com/w/images/thumb/c/ce/Bulgaria_H3035-30177r.jpg/300px-Bulgaria_H3035-30177r.jpg", 2500000));
allCoinsViewModel.push(new CoinViewModel("50 Sotinki", "1883", 2.5, 18, "Silver", null, 2400000));
allCoinsViewModel.push(new CoinViewModel("5 Leva", "1884", 25.00, 37, "Silver", null, 1500000));
allCoinsViewModel.push(new CoinViewModel("5 Leva", "1885", 25.00, 37, "Silver", "https://www.numisbids.com/sales/hosted/album/018/thumb02228.jpg", 1500000));
allCoinsViewModel.push(new CoinViewModel("10 Leva", "1894", 10.0, 27, "Gold", "http://agroplovdiv.bg/wp-content/uploads/2014/04/084143N2.jpg", 10000000));
allCoinsViewModel.push(new CoinViewModel("100 Leva", "1894", 10.0, 24, "Gold", "http://www.tableti.biz/uploads/com_article/gallery/0f2057e670c3cae8231b7d6316753fb9465652ab.jpg", 2500000));
allCoinsViewModel.push(new CoinViewModel("2-1/2 Sotinki", "1888", 2.5, 18, "Copper", null, 2400000));
示例8: onUpdateItemClick
public onUpdateItemClick(args: listViewModule.ListViewEventData) {
for (var index = 0; index < this._items.length; index++) {
this._items.getItem(index).id = Math.random() * 100;
this._items.getItem(index).itemName = "This is an updated item";
this._items.getItem(index).itemDescription = "This is the updated item's description.";
}
}
示例9:
this.responseStream = this.bluetoothService.requestStream.subscribe(response => {
if (response) {
const data = new Int16Array(response.value);
const reading: IAccelerometer = {
X: data[5] / (32768 / 16),
Y: data[4] / (32768 / 16),
Z: data[3] / (32768 / 16),
Time: ++this.counter,
};
this.source.unshift(reading);
if (this.source.length > 25) {
this.source.pop();
}
}
});
示例10: loaded
export function loaded (args:EventData){
view = args.object;
view.bindingContext = vm;
observableTweets.push(fetchData().map(function(item){
return new Observable(item);
}));
};
示例11:
this.database.addDatabaseChangeListener((changes) => {
var changeIndex;
for (var i = 0; i < changes.length; i++) {
var documentId;
documentId = changes[i].getDocumentId();
changeIndex = this.indexOfObjectId(documentId, this.personList);
var document = this.database.getDocument(documentId);
if (changeIndex == -1) {
this.personList.push(document);
} else {
this.personList.setItem(changeIndex, document);
}
}
});
示例12: serialize
private serialize() {
var items = [];
this._notifications.forEach((item: any) => {
items.push(item);
});
applicationSettingsModule.setString(NOTIFICATION_MESSAGES, JSON.stringify(items));
}
示例13: refresh
private refresh() {
var rows = this.database.executeQuery("people");
for (var i in rows) {
if (rows.hasOwnProperty(i)) {
this.personList.push(JSON.parse(rows[i]));
}
}
}
示例14: Date
service.on(NotificationMessageEvent, (args: NotificationEventData) => {
this._notifications.unshift({
Message: args.message,
Date: new Date()
});
this.serialize();
});
示例15: resolve
return new Promise<{}> ((resolve, reject) => {
houseRank.calculateRank().then(rank => {
this.houseRank.splice(0);
this.houseRank.push(rank);
resolve();
}, reject);
})