{"size": 1171, "ext": "js", "max_stars_repo_path": "src/app/channels/channel-profiles.js", "max_stars_repo_name": "nybatista/spyne-starter-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/app/channels/channel-profiles.js", "max_issues_repo_name": "nybatista/spyne-starter-app", "max_issues_repo_issues_event_min_datetime": "2020-07-16T23:41:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T10:32:31.000Z", "max_forks_repo_path": "src/app/channels/channel-profiles.js", "max_forks_repo_name": "nybatista/spyne-starter-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 6, "max_forks_count": null, "avg_line_length": 23.42, "max_line_length": 93, "alphanum_fraction": 0.6994022203}
import {Channel} from 'spyne';
import {ProfileTraits} from '../traits/profile-trait';
import {FilterTraits} from '../traits/filter-traits';

export class ChannelProfiles extends Channel {

  constructor(name, props = {}) {
    name = 'CHANNEL_PROFILES';
    props.sendCachedPayload = true;
    props.traits = [ProfileTraits, FilterTraits];
    super(name, props);
  }

  onInitialDataLoaded(e){
    this.props.data = e.payload;

    this.routeChannel$
    .subscribe(this.onProfilesRouteEvent.bind(this));
  }

  onProfilesRouteEvent(e){
    let {profileId} = e.props().routeData;
    let {routeCount} = e.props();
    let {action, payload} = this.profileTraits$GetChannelPayload(profileId, this.props.data);
    this.sendChannelPayload(action, payload);

  }


  onChannelInitialized() {

    const routeProfilePageFilter = this.filters$ProfileEventFilter();
    this.routeChannel$ = this.getChannel("CHANNEL_ROUTE", routeProfilePageFilter);

    this.getChannel('CHANNEL_USERS')
      .subscribe(this.onInitialDataLoaded.bind(this));

  }



  addRegisteredActions() {
    return [
      'CHANNEL_PROFILES_MENU_EVENT',
      'CHANNEL_PROFILES_ITEM_EVENT'
    ];
  }


}