Event emitter component.\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27838}{}\doxysection{Installation}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27838}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ component install component/emitter }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27839}{}\doxysection{API}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27839}
\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27840}{}\doxysubsection{Emitter(obj)}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27840}
The {\ttfamily Emitter} may also be used as a mixin. For example a \char`\"{}plain\char`\"{} object may become an emitter, or you may extend an existing prototype.

As an {\ttfamily Emitter} instance\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var Emitter = require('emitter');}
\DoxyCodeLine{var emitter = new Emitter;}
\DoxyCodeLine{emitter.emit('something'); }

\end{DoxyCode}


As a mixin\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var Emitter = require('emitter');}
\DoxyCodeLine{var user = \{ name: 'tobi' \};}
\DoxyCodeLine{Emitter(user);}
\DoxyCodeLine{}
\DoxyCodeLine{user.emit('im a user'); }

\end{DoxyCode}


As a prototype mixin\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var Emitter = require('emitter');}
\DoxyCodeLine{Emitter(User.prototype); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27841}{}\doxysubsection{Emitter\#on(event, fn)}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27841}
Register an {\ttfamily event} handler {\ttfamily fn}.\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27842}{}\doxysubsection{Emitter\#once(event, fn)}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27842}
Register a single-\/shot {\ttfamily event} handler {\ttfamily fn}, removed immediately after it is invoked the first time.\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27843}{}\doxysubsection{Emitter\#off(event, fn)}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27843}

\begin{DoxyItemize}
\item Pass {\ttfamily event} and {\ttfamily fn} to remove a listener.
\item Pass {\ttfamily event} to remove all listeners on that event.
\item Pass nothing to remove all listeners on all events.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27844}{}\doxysubsection{Emitter\#emit(event, ...)}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27844}
Emit an {\ttfamily event} with variable option args.\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27845}{}\doxysubsection{Emitter\#listeners(event)}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27845}
Return an array of callbacks, or an empty array.\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27846}{}\doxysubsection{Emitter\#has\+Listeners(event)}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27846}
Check if this emitter has {\ttfamily event} handlers.\hypertarget{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27847}{}\doxysection{License}\label{md_sfcode_node_modules_socket_io_parser_node_modules_component_emitter_Readme_autotoc_md27847}
MIT 