From GandalfLife, 7 Months ago, written in JavaScript.
Embed
  1. import { Component, OnInit } from '@angular/core';
  2. import { UserService } from '../../shared/user.service';
  3.  
  4. @Component({
  5.   selector: 'app-tradebar',
  6.   templateUrl: './tradebar.component.html',
  7.   styleUrls: ['./tradebar.component.css']
  8. })
  9. export class TradebarComponent implements OnInit {
  10.   canRefresh:any = true;
  11.   constructor(private userService: UserService) {
  12.  
  13.   }
  14.  
  15.   ngOnInit() {
  16.   }
  17.  
  18.   get rates(){
  19.         return this.userService.getRates();
  20.   }
  21.   get User(){
  22.     return this.userService;
  23.   }
  24.  
  25.   sendTrade(){
  26.         this.userService.sendTrade();
  27.   }
  28.  
  29.   reloadInventories(){
  30.         if(this.canRefresh){
  31.                 this.userService.refreshBotInv();
  32.                 this.userService.refreshUserInv();
  33.                 this.canRefresh = false;
  34.                 var self = this;
  35.                 setTimeout(function(){
  36.                         self.canRefresh = true;
  37.                 }, 15000)
  38.         }      
  39.   }
  40. }
  41.