Return objects with remove methods when subscribing to back or host state

Reviewed By: fkgozali

Differential Revision: D2907942

fb-gh-sync-id: 11666f2f8cd2432c42cc90bbf48ead02a75f8bc4
This commit is contained in:
Spencer Ahrens 2016-02-05 20:34:48 -08:00 committed by facebook-github-bot-9
parent cc926211b6
commit 8f6e074bd6
1 changed files with 4 additions and 1 deletions

View File

@ -59,8 +59,11 @@ var BackAndroid = {
addEventListener: function (
eventName: BackPressEventName,
handler: Function
): void {
): {remove: () => void} {
_backPressSubscriptions.add(handler);
return {
remove: () => BackAndroid.removeEventListener(eventName, handler),
};
},
removeEventListener: function(