Create an implementation of an Emitter
module. The implementation must include the following functions:
off
on
once
trigger
For more information about the API, see specification.md
.
The purpose of the task is to use:
- git commands, such as
git clone
- Node.js commands, such as e.g.
npm test
babel
(also, to understand the concept of "transpiling" from ES2015+ to ES5)Karma
for testing JavaScript code- A pre-defined specification for creating a code implementation
- The latest JavaScript specification. such as ES2015+ (this is optional)
You must write the Emitter
module in JavaScript. However, the JavaScript specification you use is up to you as the module will automatically be transpiled using babel
before passing it to the Karma
test runner.
Write all your code in the src/emitter.js
file and use the following command to run the Karma
test runner (which includes all the tests that your implementation must pass before submission):
npm test
Note: The implementation must not rely on any third-party libraries or Node.js modules.
To create the implementation, you must have Node.js v6.4.0
+ installed (either system-wide or through nvm
or similar). No global modules are required as all the necessary modules are locally installed.
Before implementing the Emitter
module, you must execute the following command to set up all the locally installed modules within the node_modules
directory:
npm run setup
Ensure that all tests defined in the test
directory are passing and execute the following command to ZIP everything required for submission:
npm run zip
Send the submission.zip
file to your Frosmo contact by e-mail or using a file sharing service such as Google Drive.
Note: Do NOT upload your final implementation to any public repository such as GitHub.