@skyway-sdk/core
Version:
The official Next Generation JavaScript SDK for SkyWay
113 lines • 3.97 kB
JavaScript
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocalPersonAdapter = void 0;
const common_1 = require("@skyway-sdk/common");
/**@internal */
class LocalPersonAdapter {
constructor(
/**@private */
_impl) {
this._impl = _impl;
this._events = new common_1.Events();
this.onLeft = this._events.make();
this.onMetadataUpdated = this._events.make();
this.onMemberStateChanged = this._events.make();
this.onStreamPublished = this._events.make();
this.onStreamUnpublished = this._events.make();
this.onPublicationListChanged = this._events.make();
this.onPublicationSubscribed = this._events.make();
this.onPublicationUnsubscribed = this._events.make();
this.onSubscriptionListChanged = this._events.make();
this.onFatalError = this._events.make();
this.apply(_impl);
}
get keepaliveIntervalSec() {
return this._impl.keepaliveIntervalSec;
}
get keepaliveIntervalGapSec() {
return this._impl.keepaliveIntervalGapSec;
}
get disableSignaling() {
return this._impl.disableSignaling;
}
get disableAnalytics() {
return this._impl.disableAnalytics;
}
get type() {
return this._impl.type;
}
get subtype() {
return this._impl.subtype;
}
get side() {
return this._impl.side;
}
get id() {
return this._impl.id;
}
get name() {
return this._impl.name;
}
get channel() {
return this._impl.channel;
}
get metadata() {
return this._impl.metadata;
}
get state() {
return this._impl.state;
}
get publications() {
return this._impl.publications;
}
get subscriptions() {
return this._impl.subscriptions;
}
// localPersonにAdapterを適用する
apply(person) {
this._impl = person;
person.onLeft.pipe(this.onLeft);
person.onMetadataUpdated.pipe(this.onMetadataUpdated);
person.onStreamPublished.pipe(this.onStreamPublished);
person.onStreamUnpublished.pipe(this.onStreamUnpublished);
person.onPublicationListChanged.pipe(this.onPublicationListChanged);
person.onPublicationSubscribed.pipe(this.onPublicationSubscribed);
person.onPublicationUnsubscribed.pipe(this.onPublicationUnsubscribed);
person.onSubscriptionListChanged.pipe(this.onSubscriptionListChanged);
person.onFatalError.pipe(this.onFatalError);
}
subscribe(publication, options) {
return this._impl.subscribe(publication, options);
}
unsubscribe(subscription) {
return this._impl.unsubscribe(subscription);
}
publish(stream, options = {}) {
return this._impl.publish(stream, options);
}
unpublish(publication) {
return this._impl.unpublish(publication);
}
updateMetadata(metadata) {
return this._impl.updateMetadata(metadata);
}
leave() {
return __awaiter(this, void 0, void 0, function* () {
yield this._impl.leave();
});
}
dispose() {
this._impl.dispose();
}
}
exports.LocalPersonAdapter = LocalPersonAdapter;
//# sourceMappingURL=adapter.js.map