{"size": 386, "ext": "js", "max_stars_repo_path": "examples/worker-gateway-sandbox/environment.js", "max_stars_repo_name": "alexeyraspopov/event-sourcing", "max_stars_repo_stars_event_min_datetime": "2016-12-12T09:27:53.000Z", "max_stars_repo_stars_event_max_datetime": "2017-12-15T15:51:52.000Z", "max_issues_repo_path": "examples/worker-gateway-sandbox/environment.js", "max_issues_repo_name": "alexeyraspopov/message-script", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/worker-gateway-sandbox/environment.js", "max_forks_repo_name": "alexeyraspopov/message-script", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.3157894737, "max_line_length": 61, "alphanum_fraction": 0.6113989637}
class UniformEnvironment {
  constructor(nodes = [], routine) {
    this.nodes = nodes;
    this.routine = routine;

    const eventHandler = (event) => {
      this.routine(event.data.message, event.data.sender);
    };

    for (const node of this.nodes) node.listen(eventHandler);
  }

  send(message) {
    for (const node of this.nodes) {
      node.post({ message });
    }
  }
}
