{"size": 612, "ext": "js", "max_stars_repo_path": "Extension/background.js", "max_stars_repo_name": "gjain-7/Misc-6-Infinity-Remote", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Extension/background.js", "max_issues_repo_name": "gjain-7/Misc-6-Infinity-Remote", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Extension/background.js", "max_forks_repo_name": "gjain-7/Misc-6-Infinity-Remote", "max_forks_repo_forks_event_min_datetime": "2021-06-30T18:16:17.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-08T21:20:36.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 25.5, "max_line_length": 74, "alphanum_fraction": 0.6519607843}
const socket = io("https://infinity-remote.herokuapp.com");
socket.on("connect", function () {
  console.log("content initiated", socket.id);
  chrome.storage.local.set({ roomId: socket.id });
});

function apply(message) {
  let params = {
    active: true,
    currentWindow: true,
  };
  chrome.tabs.query(params, function (tabs) {
    chrome.tabs.sendMessage(tabs[0].id, message);
  });
}

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  socket.emit("messageFromExtension", message);
});

socket.on("messageFromRemote", (message) => {
  apply(message);
});
