本文整理汇总了TypeScript中data/observable-array.ObservableArray类的典型用法代码示例。如果您正苦于以下问题:TypeScript ObservableArray类的具体用法?TypeScript ObservableArray怎么用?TypeScript ObservableArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObservableArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:maya-z,项目名称:recycler-view-demo,代码行数:16,代码来源:main-view-model.ts
示例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."));
}
}
开发者ID:nativescript-toolbox,项目名称:fork_nativescript-ui-samples,代码行数:7,代码来源:selection-states-model.ts
示例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/"));
}
}
}
开发者ID:ignaciolarranaga,项目名称:nativescript-fresco,代码行数:9,代码来源:main-view-model.ts
示例4: clear
public clear() {
this._notifications.length = 0;
this._notifications.notify({
eventName: ObservableArray.changeEvent,
object: this._notifications
});
this.serialize();
}
开发者ID:AkJones2007,项目名称:sample-Xpensity,代码行数:9,代码来源:notifications-view-model.ts
示例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]);
}
}
}
}
开发者ID:aymenbraiek,项目名称:nativescript-sdk-examples-ng,代码行数:11,代码来源:clear-search-bar.component.ts
示例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);
}
});
开发者ID:burkeholland,项目名称:nativescript-devdays,代码行数:19,代码来源:session-service.ts
示例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));
开发者ID:pokleh,项目名称:poc-nativescript-catalogApp,代码行数:16,代码来源:full-catalog-view-model.ts
示例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.";
}
}
开发者ID:Anupam-,项目名称:nativescript-ui-samples,代码行数:7,代码来源:observable-array-model.ts
示例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();
}
}
});
开发者ID:racketometer,项目名称:frontend-application,代码行数:16,代码来源:session-live.component.ts
示例10: loaded
export function loaded (args:EventData){
view = args.object;
view.bindingContext = vm;
observableTweets.push(fetchData().map(function(item){
return new Observable(item);
}));
};
开发者ID:ignaciofuentes,项目名称:nativescript-twitterclone,代码行数:7,代码来源:list.ts
示例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);
}
}
});
开发者ID:NathanWalker,项目名称:nativescript-couchbase,代码行数:16,代码来源:list-view-model.ts
示例12: serialize
private serialize() {
var items = [];
this._notifications.forEach((item: any) => {
items.push(item);
});
applicationSettingsModule.setString(NOTIFICATION_MESSAGES, JSON.stringify(items));
}
开发者ID:AkJones2007,项目名称:sample-Xpensity,代码行数:8,代码来源:notifications-view-model.ts
示例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]));
}
}
}
开发者ID:chimon2000,项目名称:nativescript-couchbase,代码行数:8,代码来源:list-view-model.ts
示例14: Date
service.on(NotificationMessageEvent, (args: NotificationEventData) => {
this._notifications.unshift({
Message: args.message,
Date: new Date()
});
this.serialize();
});
开发者ID:AkJones2007,项目名称:sample-Xpensity,代码行数:8,代码来源:notifications-view-model.ts
示例15: resolve
return new Promise<{}> ((resolve, reject) => {
houseRank.calculateRank().then(rank => {
this.houseRank.splice(0);
this.houseRank.push(rank);
resolve();
}, reject);
})
开发者ID:sebawita,项目名称:SportsDay,代码行数:9,代码来源:ranking-view-model.ts
示例16: preparePictures
private preparePictures() {
this._todoItems.push(new ListItem("Call Brian Ingram regarding the hotel reservations", false, false));
this._todoItems.push(new ListItem("See weather forecast for London", true, false));
this._todoItems.push(new ListItem("Prepare the children's documents", false, false));
this._todoItems.push(new ListItem("Check the Paris - London trains schedule", true, false));
this._todoItems.push(new ListItem("Ask Jonah if he will take care of the dog", false, false));
this._todoItems.push(new ListItem("Reschedule airplane tickets for the next month's flight to Hawaii", false, false));
this._todoItems.push(new ListItem("Bills due: Alissa's ballet class fee", false, false));
this._shoppingList.push(new ListItem("Milk", false, false));
this._shoppingList.push(new ListItem("Salmon", true, false));
this._shoppingList.push(new ListItem("Eggs", false, false));
this._shoppingList.push(new ListItem("Almonds", true, false));
this._shoppingList.push(new ListItem("Chicken", false, false));
this._shoppingList.push(new ListItem("Beef", false, false));
this._shoppingList.push(new ListItem("Yogurt", false, false));
this._shoppingList.push(new ListItem("Spinach", false, false));
this._shoppingList.push(new ListItem("Carrots", true, false));
this._shoppingList.push(new ListItem("Apples", false, false));
this._shoppingList.push(new ListItem("Tomatoes", true, false));
}
开发者ID:MantisWare,项目名称:nativescript-marketplace-demo,代码行数:21,代码来源:listview-reorder-model.ts
示例17:
this.arrayItems.forEach(item => {
this.myItems.push(item);
});
开发者ID:aymenbraiek,项目名称:nativescript-sdk-examples-ng,代码行数:3,代码来源:clear-search-bar.component.ts
示例18: onUserTap
public onUserTap(userItem: ItemEventData): void {
let user = this.users.getItem(userItem.index);
this.sessionService.setCurrentUser(user);
this.router.navigate(["bluetooth"]);
}
开发者ID:racketometer,项目名称:frontend-application,代码行数:5,代码来源:users.component.ts
示例19: onRemoveItemClick
public onRemoveItemClick(args: ListViewEventData) {
this._dataItems.splice(this._dataItems.length - 1, 1);
}
开发者ID:drejohnson,项目名称:nativescript-ui-samples-angular,代码行数:3,代码来源:listview-observable-array.component.ts
示例20: refresh
private refresh() {
var rows = this.database.executeQuery("people");
for(var i = 0; i < rows.length; i++) {
this.personList.push(rows[i]);
}
}
开发者ID:NathanWalker,项目名称:nativescript-couchbase,代码行数:6,代码来源:list-view-model.ts
注:本文中的data/observable-array.ObservableArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论