@wscsports/blaze-rtn-sdk
Version:
WSC Sports Blaze SDK component for React Native
39 lines (38 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BlazeFollowEntitiesDelegateHelper = void 0;
var _BlazeGlobalEvents = require("../shared/BlazeGlobalEvents");
class BlazeFollowEntitiesDelegateHelper {
static registerFollowEntitiesDelegate(delegate) {
BlazeFollowEntitiesDelegateHelper.onFollowEntityClicked(delegate?.onFollowEntityClicked);
}
static onFollowEntityClicked(callback) {
const eventName = 'Blaze.onFollowEntityClicked';
if (callback) {
_BlazeGlobalEvents.BlazeGlobalEvents.createEventSubscription(eventName, data => {
try {
const playerType = data['playerType'];
const sourceId = data['sourceId'];
const newFollowingState = data['newFollowingState'];
const followEntity = {
id: data['followEntityId']
};
callback({
playerType,
sourceId,
newFollowingState,
followEntity
});
} catch (e) {
console.error('BlazeFollowEntitiesDelegateHelper.onFollowEntityClicked', e);
}
});
} else {
_BlazeGlobalEvents.BlazeGlobalEvents.cancelEventSubscription(eventName);
}
}
}
exports.BlazeFollowEntitiesDelegateHelper = BlazeFollowEntitiesDelegateHelper;
//# sourceMappingURL=follow-entities-delegate.js.map