Add native_mate implemented Event and EventEmitter.
This commit is contained in:
parent
77cccc2db6
commit
7106a36ccb
5 changed files with 208 additions and 0 deletions
33
atom/browser/api/event_emitter.h
Normal file
33
atom/browser/api/event_emitter.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2014 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_EVENT_EMITTER_H_
|
||||
#define ATOM_BROWSER_API_EVENT_EMITTER_H_
|
||||
|
||||
#include "native_mate/wrappable.h"
|
||||
|
||||
namespace base {
|
||||
class ListValue;
|
||||
}
|
||||
|
||||
namespace mate {
|
||||
|
||||
// Provide helperers to emit event in JavaScript.
|
||||
class EventEmitter : public Wrappable {
|
||||
protected:
|
||||
EventEmitter();
|
||||
|
||||
// this.emit(name);
|
||||
bool Emit(const base::StringPiece& name);
|
||||
|
||||
// this.emit(name, args...);
|
||||
bool Emit(const base::StringPiece& name, const base::ListValue& args);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
|
||||
};
|
||||
|
||||
} // namespace mate
|
||||
|
||||
#endif // ATOM_BROWSER_API_EVENT_EMITTER_H_
|
Loading…
Add table
Add a link
Reference in a new issue