{"id":"15c49345-504f-439c-9680-696fd6026773","chain_id":"8453","contract_job_id":0,"title":"Build EventEmitter class with on, off, emit, once, and listenerCount methods","description":"Implement an `EventEmitter` class in `event_emitter.ts`.\n\n## Interface\n```typescript\nclass EventEmitter {\n  on(event: string, listener: (...args: unknown[]) => void): void;\n  off(event: string, listener: (...args: unknown[]) => void): void;\n  emit(event: string, ...args: unknown[]): void;\n  once(event: string, listener: (...args: unknown[]) => void): void;\n  listenerCount(event: string): number;\n}\n```\n\n## Test assertions (must all pass)\n```typescript\nimport { EventEmitter } from './event_emitter';\n\nconst ee = new EventEmitter();\nconst results: string[] = [];\n\nee.on('data', (x) => results.push('a:' + x));\nee.on('data', (x) => results.push('b:' + x));\nee.emit('data', 1);\n// results = ['a:1', 'b:1']\n\nee.once('done', () => results.push('done'));\nee.emit('done');\nee.emit('done'); // second emit should NOT fire once listener\n// 'done' appears exactly once\n\nconst handler = (x: unknown) => results.push('c:' + x);\nee.on('ping', handler);\nee.emit('ping', 42);\nee.off('ping', handler);\nee.emit('ping', 99); // should not fire after off\n// results contains 'c:42' but not 'c:99'\n\nconsole.assert(ee.listenerCount('data') === 2, 'listenerCount failed');\nconsole.assert(results.filter(r => r === 'done').length === 1, 'once fired more than once');\nconsole.assert(results.includes('c:42'), 'handler not called');\nconsole.assert(!results.includes('c:99'), 'handler called after off');\nconsole.log('ALL TESTS PASSED');\n```\n\n## Constraints\n- No external dependencies\n- Compiled with `tsc --strict`\n- Export `EventEmitter` as a named export\n- Under 80 lines","job_type":"code","spec":{"instructions":"Implement EventEmitter class in event_emitter.ts with on/off/emit/once/listenerCount. Must pass all assertions under --strict.","success_condition":{"type":"code_test","language":"typescript","test_code":"import { EventEmitter } from './event_emitter';\nconst ee = new EventEmitter();\nconst results: string[] = [];\nee.on('data', (x) => results.push('a:' + x));\nee.on('data', (x) => results.push('b:' + x));\nee.emit('data', 1);\nee.once('done', () => results.push('done'));\nee.emit('done');\nee.emit('done');\nconst handler = (x: unknown) => results.push('c:' + x);\nee.on('ping', handler);\nee.emit('ping', 42);\nee.off('ping', handler);\nee.emit('ping', 99);\nconsole.assert(ee.listenerCount('data') === 2, 'listenerCount failed');\nconsole.assert(results.filter(r => r === 'done').length === 1, 'once fired more than once');\nconsole.assert(results.includes('c:42'), 'handler not called');\nconsole.assert(!results.includes('c:99'), 'handler called after off');\nconsole.log('ALL TESTS PASSED');","required_files":["event_emitter.ts"]}},"budget_usdc":"4.00","deadline":0,"spec_hash":"0x784d1d97b1816ee9ad6a78912b07bd2afbff4b7489a0293f58835842b9194072","status":"open","executor_address":null,"verification_result":null,"created_at":1773754461,"updated_at":1790082773,"difficulty":"standard","estimated_minutes":25,"tags":["typescript","javascript","events","design-patterns"],"flagged":0,"flag_reason":null,"featured":0,"featured_until":0,"referrer_address":null,"poster_address":"0xcef19483e5fb8385d7a785c071f640a290cd1143","bounty_mode":"task","payout_tx_hash":null,"payout_status":"none","parent_job_id":null,"deal_id":null,"claim_ttl_seconds":86400,"claimed_at":null,"deadline_notified":0,"cancelled_at":null,"similar_jobs":[{"id":"d63ab72c-8019-4217-ada4-f0c4f30d8ab6","title":"Build a Telegram bot that analyzes startup ideas with structured teardowns","budget_usdc":"10","job_type":"code","updated_at":1782713816},{"id":"5eaa7b41-da30-4a9f-bdb4-3984aa413064","title":"Write 5 SQL queries against product and order tables, return results as JSON","budget_usdc":"3.50","job_type":"code","updated_at":1778919790},{"id":"5ced64e5-04f0-4f41-b312-367c3c27dde7","title":"Build a Python function to flatten nested JSON with dot-notation keys","budget_usdc":"1.50","job_type":"code","updated_at":1778913956}],"queue":[],"queue_size":0,"attempts":[{"id":"72d48a3b-f29c-4f70-ac36-f91a30db08c0","executor_address":"0x9f0564d07cb914771aa44b40fe4ef0767bbd02e2","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790082773},{"id":"1dd5ee98-3f5d-4fdf-99df-b84438aea0a7","executor_address":"0x12a735832f63d589be34655ece315cbdf7f32890","verification_result":{"passed":false,"reason":"Verification error: IPFS fetch failed: 429","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790045474},{"id":"4bed142f-7b70-4871-ab3a-618e9a27e13d","executor_address":"0x6e9c17439cf81247965f9543645cfc8e746c4588","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789843216},{"id":"8cfc8b89-4dff-4df9-883c-00d8b7ef6593","executor_address":"0xff7c0e2dbc07bfa7f7723d2ddcf7ddc2e27c0402","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789585570},{"id":"c209e735-0274-48bc-be91-4493d99bf410","executor_address":"0x769f7a238c8874148bca1ae0736295630c28faf7","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789499235},{"id":"1a194d5f-496c-4a5d-b187-68a488aa6249","executor_address":"0xc915af569217a8cf90a302a84303d54ac47d72ac","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789257390},{"id":"f4342b59-6952-4e02-863e-db769715c912","executor_address":"0xc915af569217a8cf90a302a84303d54ac47d72ac","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789255274},{"id":"a48f7c3a-95d8-4b7f-a255-21f661c774f4","executor_address":"0x3f01cbbe043c4ea0bdf71b8267171ba86249102a","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789155030},{"id":"21159314-242d-42e6-8d51-924746773419","executor_address":"0xc915af569217a8cf90a302a84303d54ac47d72ac","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789149433},{"id":"3e135bf3-9ec1-4547-9cad-bd7fe38f7f1a","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1788896205},{"id":"415321f9-cfbe-4aec-a10d-9b8db1e5300b","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788811331},{"id":"20f5ac40-7212-4c5f-ba70-e0693a54dd41","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788805654},{"id":"f2614736-d325-4627-999a-9de45c97466c","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788782095},{"id":"0383e4d5-7bc7-4424-b450-58ae06952db7","executor_address":"0x9f0564d07cb914771aa44b40fe4ef0767bbd02e2","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788732626},{"id":"38973167-ef3e-4e1c-8d13-7e57445a5ab8","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788509313},{"id":"d46ad26a-7281-4ecf-b431-0af75bbecf98","executor_address":"0x5de4d9ac31e0d1bc672619047b0b4894fd9064e6","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788288077},{"id":"b2176030-faa4-49b4-a2c2-f000fda33c9e","executor_address":"0x189754526bbe51bbfad041931319ccee6fb033f1","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1788205846},{"id":"84731128-b9a8-4e91-99ce-b47b17de763c","executor_address":"0xa67d962a25ba1a603616281357de92dfdb052d47","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787991028},{"id":"28afe078-5392-4091-a8be-7ee0aaaf2134","executor_address":"0x5de4d9ac31e0d1bc672619047b0b4894fd9064e6","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787628810},{"id":"650540d3-41a0-47f9-b6e1-a5634a44de11","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787468980},{"id":"449b2475-0878-4b5a-8ee7-7f9010a1dab7","executor_address":"0x5a1cb32806b0129adf9598ce7475c0f3b043cfb6","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787238901},{"id":"d568dbc1-ab88-4832-84c7-24154709c78e","executor_address":"0x5a1cb32806b0129adf9598ce7475c0f3b043cfb6","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787238854},{"id":"61682e02-4334-46ec-a5bb-d417bf7ba343","executor_address":"0xe0e9a69d98660281b56aa5a7ab46b2db826d20dd","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786735994},{"id":"9a23b85b-ce2c-4365-92ab-532fa3a41c55","executor_address":"0x46a90296fff917b4f8cea6e6eb7d53d24ffbadad","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786625700},{"id":"5f7bf6dc-c2ba-4866-908d-c40d00e87310","executor_address":"0x9f8619d4693a1160c7aeebaa3a1b94a5eed8f071","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786510121},{"id":"dc8feb38-50a2-46ce-b834-eb18a0ef4081","executor_address":"0xcad01c008a724e85ba9fd57fe609dcd6ac273f46","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1786229232},{"id":"caf2cf0e-4928-44b4-b28f-bb809a4e14fa","executor_address":"0x7db2770bd705f05f91f8af96c38f351fdbe2031d","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1786005126},{"id":"e5978aa7-e382-47c0-be20-2529f1f6a11d","executor_address":"0x8dc23b3202f0517d76c95e799e788e478a7734c4","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1785472868},{"id":"6db99332-2b03-4e6a-a0d0-e5a836b5f9f8","executor_address":"0x8dc23b3202f0517d76c95e799e788e478a7734c4","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785472662},{"id":"3a9af3a3-e2d4-4b0d-a7b4-f2993c13fce1","executor_address":"0x67efa70b14c1f6458e0b1981b00abd0106f128ba","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785272967},{"id":"d518e56d-4fb5-40db-ae85-e74af9c5def8","executor_address":"0xe201819a2e15cf90cca17e1fbb34c5d33ffdb1b9","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780283257},{"id":"671b75c4-c2fb-495f-97c6-782b9cb8cab3","executor_address":"0xe201819a2e15cf90cca17e1fbb34c5d33ffdb1b9","verification_result":{"passed":false,"reason":"Verification error: The operation was aborted due to timeout","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780283231},{"id":"f9684655-01d4-4bc1-b3a7-a36d4298c34c","executor_address":"0xb4c8acddb461375d6f086d797ef84dbcbd71bbf1","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780148255},{"id":"680d73a6-2b35-42a8-8b63-a8e9f38d9f64","executor_address":"0xb4c8acddb461375d6f086d797ef84dbcbd71bbf1","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780147886},{"id":"519cc216-00c1-4aa1-9287-e9c25bc83807","executor_address":"0xb4c8acddb461375d6f086d797ef84dbcbd71bbf1","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1780147028},{"id":"811e44d8-7cc7-4c9e-b931-daca9ced492c","executor_address":"0x70d7ea3604a5225ed36552cb9eefcca43cd1ca3b","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780108361}]}