#ifndef node_events_h #define node_events_h #include "node.h" #include namespace node { class EventEmitter : public ObjectWrap { public: static void Initialize (v8::Handle target); static v8::Persistent constructor_template; virtual size_t size (void) { return sizeof(EventEmitter); }; bool Emit (const char *type, int argc, v8::Handle argv[]); protected: EventEmitter (v8::Handle handle) : ObjectWrap(handle) { } }; class Promise : public EventEmitter { public: static void Initialize (v8::Handle target); static v8::Persistent constructor_template; virtual size_t size (void) { return sizeof(Promise); }; bool EmitSuccess (int argc, v8::Handle argv[]); bool EmitError (int argc, v8::Handle argv[]); static Promise* Create (void); v8::Handle Handle(void) { return handle_; } protected: Promise (v8::Handle handle) : EventEmitter(handle) { } }; } // namespace node #endif