當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ng-socket-io.Socket類代碼示例

本文整理匯總了TypeScript中ng-socket-io.Socket的典型用法代碼示例。如果您正苦於以下問題:TypeScript Socket類的具體用法?TypeScript Socket怎麽用?TypeScript Socket使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Socket類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
      });
    });
  } 
開發者ID:jessiejane,項目名稱:SimpleLiving,代碼行數:33,代碼來源:Inventory.ts

示例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);
        }
    });
  }
開發者ID:jessiejane,項目名稱:SimpleLiving,代碼行數:31,代碼來源:lists.ts

示例3: writeSocket

 writeSocket(message) {
   this.socket.emit('move', {'data': message});
 }
開發者ID:ilikehaskell,項目名稱:ElectroMobility,代碼行數:3,代碼來源:testing.component.ts

示例4: constructor

 constructor(private socket: Socket) { 
   socket.on('new notification', function(data){
      alert(data)
   });
 }
開發者ID:mikeshif,項目名稱:workingexampNotification,代碼行數:5,代碼來源:user.component.ts

示例5: ngOnInit

  ngOnInit() {
	this.socket.on('answer', (data) => console.log(data));
  }
開發者ID:ilikehaskell,項目名稱:ElectroMobility,代碼行數:3,代碼來源:testing.component.ts

示例6: Observable

 let observable = new Observable(observer => {
   this.socket.on('change-smartstock-count', (data) => {
     observer.next(data);
   });
   console.log('RECEIVING SMARTSTOCK UPDATE');
 });
開發者ID:jessiejane,項目名稱:SimpleLiving,代碼行數:6,代碼來源:Inventory.ts

示例7: sendNotification

 sendNotification(){
   this.socket.emit('create notification','Hello there! You have notifiication');
 }
開發者ID:mikeshif,項目名稱:workingexampNotification,代碼行數:3,代碼來源:admin.component.ts

示例8: updateDeletedItem

 updateDeletedItem(item: any){
   this.socket.emit('delete-item', item);
 }
開發者ID:jessiejane,項目名稱:SimpleLiving,代碼行數:3,代碼來源:lists.ts


注:本文中的ng-socket-io.Socket類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。