Skip to content

Commit

Permalink
Rename some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Jul 28, 2019
1 parent 2492da2 commit 7d90c01
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Libraries/Utilities/DevSettings.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import NativeDevSettings from '../NativeModules/specs/NativeDevSettings';
import EventEmitter from '../EventEmitter/NativeEventEmitter';
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';

class DevSettings extends EventEmitter {
_items: Map<string, () => mixed>;
class DevSettings extends NativeEventEmitter {
_menuItems: Map<string, () => mixed>;

constructor() {
super(NativeDevSettings);

this._items = new Map();
this._menuItems = new Map();
}

addMenuItem(title: string, handler: () => mixed) {
// Make sure items are not added multiple times. This can
// happen when hot reloading the module that registers the
// menu items. The title is used as the id which means we
// don't support multiple items with the same name.
const oldHandler = this._items.get(title);
const oldHandler = this._menuItems.get(title);
if (oldHandler != null) {
this.removeListener('didPressMenuItem', oldHandler);
} else {
NativeDevSettings.addMenuItem(title);
}

this._items.set(title, handler);
this._menuItems.set(title, handler);
this.addListener('didPressMenuItem', (event) => {
if (event.title === title) {
handler();
Expand Down

0 comments on commit 7d90c01

Please sign in to comment.