UNPKG

teoclits

Version:

Typescript angular Teonet Client module

62 lines 2.12 kB
import { Component } from '@angular/core'; import { TeonetCli, Teonet } from './teocli.module'; var TeonetPeerSelect = /** @class */ (function () { // private interval = IntervalObservable.create(1000).subscribe(() => { //.subscribe(n => this.n = n); // this.n++; // if (this.isComponentActive()) this.t.peers(Teonet.peer.l0); // }); function TeonetPeerSelect(t) { var _this = this; this.t = t; this.n = 0; this.peers = []; this.f = []; console.log('TeonetPeers::constructor'); this.f.push(t.whenEvent('onpeers', function (data) { console.log('TeonetPeers::constructor: onpeers', data); _this.peers = data[0][0].data.arp_data_ar; if (_this.onpeers) _this.onpeers(); return 0; })); this.t.peers(Teonet.peer.l0); } TeonetPeerSelect.prototype.getPeer = function () { return Teonet.peer.l0; }; TeonetPeerSelect.prototype.setPeer = function (name) { Teonet.peer.l0 = name; }; TeonetPeerSelect.prototype.ngOnDestroy = function () { for (var _i = 0, _a = this.f; _i < _a.length; _i++) { var f = _a[_i]; this.t.unsubscribe(f); } //this.interval.unsubscribe(); }; TeonetPeerSelect.decorators = [ { type: Component, args: [{ selector: 'teonet-peer-select', styles: ['\n\ .border-right {\n\ border-right: solid 1px #eee;\n\ }\n\ .header {\n\ border: solid 1px #eee;\n\ }\n\ '], template: '\n\ <select class="browser-default custom-select" #t (change)="setPeer(t.value)">\n\ <option [value]="peer.name" [selected]="peer.name == getPeer()" *ngFor="let peer of peers">{{ peer.name }}</option>\n\ </select>\n\ \n' },] }, ]; /** @nocollapse */ TeonetPeerSelect.ctorParameters = function () { return [ { type: TeonetCli } ]; }; return TeonetPeerSelect; }()); export { TeonetPeerSelect }; //# sourceMappingURL=teocli.peer_select.js.map