{"id":19324667,"url":"https://github.com/soarez/m2e","last_synced_at":"2026-06-09T20:31:14.466Z","repository":{"id":6214450,"uuid":"7445639","full_name":"soarez/M2E","owner":"soarez","description":"Simple Message to Events plug","archived":false,"fork":false,"pushed_at":"2013-11-18T12:04:11.000Z","size":178,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-18T03:14:55.381Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soarez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-04T19:05:46.000Z","updated_at":"2013-11-18T12:04:17.000Z","dependencies_parsed_at":"2022-09-10T21:23:07.742Z","dependency_job_id":null,"html_url":"https://github.com/soarez/M2E","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soarez%2FM2E","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soarez%2FM2E/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soarez%2FM2E/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soarez%2FM2E/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soarez","download_url":"https://codeload.github.com/soarez/M2E/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240427293,"owners_count":19799471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T02:06:18.024Z","updated_at":"2026-06-09T20:31:14.428Z","avatar_url":"https://github.com/soarez.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# M2E\n\n#### *Simple Message to Events plug.*\n\nSome APIs are message oriented, like the WebWorker's and WebSocket's API.\n\nI prefer to work with events.\n\n## Usage\n\nTo create an M2E object, you need to give it a function to send messages,\nwhen events are triggered, and there's a hook you're responsible to call when\na new message arrives.\n\nExample with webworkers:\n\n````js\n// WebWorker\n\nimportScripts('build/m2e.js);\n\n// ***********\n// ** M2E PLUG\nvar m2e = M2E(self.postMessage.bind(self));\nself.onmessage = function(event) { m2e.onMessage(event.data); };\n\n// \nm2e.addListener('echo', function(arg1, arg2) {\n  m2e.emit('customEvt', arg1, arg2);\n});\n````\n\nGUI thread:\n\n````js\nvar worker = new Worker('worker.js?fu_cache=' + +new Date());\n\nvar m2e = M2E(worker.postMessage.bind(worker));\nworker.onmessage = function(event) { m2e.onMessage(event.data); };\n\nvar p1 = 'abc', p2 = 'def';\nm2e.addListener('customEvt', function(arg1, arg2) {\n  // p1 == 'abc'\n  // p2 == 'def'\n})\nm2e.emit('echo', p1, p2);\n````\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoarez%2Fm2e","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoarez%2Fm2e","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoarez%2Fm2e/lists"}