wallet-storage-client
Version:
Client only Wallet Storage
31 lines • 989 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServiceCollection = void 0;
class ServiceCollection {
constructor(services) {
this.services = services || [];
this._index = 0;
}
add(s) {
this.services.push(s);
return this;
}
remove(name) {
this.services = this.services.filter(s => s.name !== name);
}
get name() { return this.services[this._index].name; }
get service() { return this.services[this._index].service; }
get allServices() { return this.services.map(x => x.service); }
get count() { return this.services.length; }
get index() { return this._index; }
reset() { this._index = 0; }
next() {
this._index = (this._index + 1) % this.count;
return this._index;
}
clone() {
return new ServiceCollection([...this.services]);
}
}
exports.ServiceCollection = ServiceCollection;
//# sourceMappingURL=ServiceCollection.js.map