PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Snowflake

Implement an event emitter

Last updated: Apr 2, 2026

Quick Overview

This question evaluates understanding of event-driven programming and API design in a frontend environment, specifically the ability to manage event listener registration, removal, and invocation while preserving listener ordering and independent event storage.

  • medium
  • Snowflake
  • Coding & Algorithms
  • Frontend Engineer

Implement an event emitter

Company: Snowflake

Role: Frontend Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Implement an `EventEmitter` class for a frontend environment. The class should support these methods: - `on(eventName, listener)`: register a listener function for an event. - `off(eventName, listener)`: remove one previously registered listener for that event. - `emit(eventName, ...args)`: invoke all listeners registered for that event in registration order, passing through all provided arguments. Requirements: - Multiple listeners may be registered for the same event. - Removing one listener must not affect other listeners. - Emitting an event with no listeners should do nothing. - Listeners for different event names must be stored independently. - The implementation should be suitable for typical frontend usage.

Quick Answer: This question evaluates understanding of event-driven programming and API design in a frontend environment, specifically the ability to manage event listener registration, removal, and invocation while preserving listener ordering and independent event storage.

Related Interview Questions

  • Solve Array Distance and Wiki Navigation - Snowflake (medium)
  • Implement Document Predicate APIs - Snowflake (medium)
  • Find Shortest Wiki Click Path - Snowflake (medium)
  • Schedule prerequisite classes with retakes - Snowflake (easy)
  • Solve three coding rounds - Snowflake (medium)
Snowflake logo
Snowflake
Jan 11, 2026, 12:00 AM
Frontend Engineer
Technical Screen
Coding & Algorithms
2
0
Loading...

Implement an EventEmitter class for a frontend environment.

The class should support these methods:

  • on(eventName, listener) : register a listener function for an event.
  • off(eventName, listener) : remove one previously registered listener for that event.
  • emit(eventName, ...args) : invoke all listeners registered for that event in registration order, passing through all provided arguments.

Requirements:

  • Multiple listeners may be registered for the same event.
  • Removing one listener must not affect other listeners.
  • Emitting an event with no listeners should do nothing.
  • Listeners for different event names must be stored independently.
  • The implementation should be suitable for typical frontend usage.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Snowflake•More Frontend Engineer•Snowflake Frontend Engineer•Snowflake Coding & Algorithms•Frontend Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.