2013-04-15 16:25:08 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_BROWSER_API_ATOM_API_EVENT_EMITTER_H_
|
|
|
|
#define ATOM_BROWSER_API_ATOM_API_EVENT_EMITTER_H_
|
|
|
|
|
2013-04-18 15:50:47 +00:00
|
|
|
#include <iosfwd>
|
|
|
|
|
2013-04-20 13:52:46 +00:00
|
|
|
#include "browser/api/atom_api_recorded_object.h"
|
2013-04-15 16:25:08 +00:00
|
|
|
|
2013-04-18 15:50:47 +00:00
|
|
|
namespace base {
|
|
|
|
class ListValue;
|
|
|
|
}
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
namespace api {
|
|
|
|
|
|
|
|
// Class interiting EventEmitter should assume it's a javascript object which
|
|
|
|
// interits require('events').EventEmitter, this class provides many helper
|
|
|
|
// methods to do event processing in C++.
|
2013-04-20 13:52:46 +00:00
|
|
|
class EventEmitter : public RecordedObject {
|
2013-04-15 16:25:08 +00:00
|
|
|
public:
|
|
|
|
virtual ~EventEmitter();
|
|
|
|
|
2013-04-18 15:50:47 +00:00
|
|
|
// Emit an event and returns whether the handler has called preventDefault().
|
|
|
|
bool Emit(const std::string& name, base::ListValue* args);
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
protected:
|
|
|
|
explicit EventEmitter(v8::Handle<v8::Object> wrapper);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace api
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_BROWSER_API_ATOM_API_EVENT_EMITTER_H_
|