本文整理匯總了TypeScript中ng-socket-io.Socket.connect方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Socket.connect方法的具體用法?TypeScript Socket.connect怎麽用?TypeScript Socket.connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ng-socket-io.Socket
的用法示例。
在下文中一共展示了Socket.connect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(public navCtrl: NavController, public navParams: NavParams, public http: Http, public restService: RestService, private socket: Socket)
{
this.socket.connect();
// If we navigated to this page, we will have an item available as a nav param
this.selectedItem = navParams.get('item');
this.listNames = ['Groceries', 'Bills', 'Cleaning Supplies', 'Household Chores',
'Maintenance Requests', 'Hardware', 'Events']
this.icons = ['basket', 'cash', 'cart', 'clipboard', 'hammer', 'bulb', 'beer' ];
this.items = [];
for (let i = 1; i < this.listNames.length; i++) {
this.items.push({
title: this.listNames[i-1],
note: i,
icon: this.icons[i-1]
});
}
this.restService.populateInventory().then(response => {
this.listitems = response.Item;
});
this.getSmartStockEvent().subscribe(data => {
this.smartStockInventory = data['count'];
this.smartStockItemId = data['id'];
this.restService.populateInventory().then(response => {
this.listitems = response.Item;
});
});
}
示例2: constructor
constructor(public navCtrl: NavController, public navParams: NavParams, public restService: RestService, private socket: Socket)
{
this.socket.connect();
this.restService.getLists().then(data => {
this.lists = data.List;
})
this.getCount().subscribe(data => {
this.updatedItem = data;
console.log("** UPDATE COUNT OF ITEM " + this.updatedItem.ItemId + " to " + this.updatedItem.Quantity);
if (this.selectedList === this.updatedItem.ListId)
{
this.restService.getLists().then(data => {
this.lists = data.List;
this.restService.getListItems(this.selectedList).then(data => {
this.listitems = data.Item;
});
});
}
});
this.getDeleteEvent().subscribe(data => {
this.deletedItem = data;
if (this.selectedList === this.deletedItem.ListId)
{
this.showItems(this.selectedList);
console.log("** REMOVED DELETED ITEM " + this.selectedList);
}
});
}