1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

global message handler for popop

This commit is contained in:
Kyle Spearrin
2018-01-13 20:30:14 -05:00
parent b6a8594d08
commit 64e2debb77
2 changed files with 16 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ export class MainController implements ng.IController {
}
});
BrowserApi.messageListener((msg: any, sender: any, sendResponse: any) => {
$window.bitwardenPopupMainMessageListener = (msg: any, sender: any, sendResponse: any) => {
if (msg.command === 'syncCompleted') {
$scope.$broadcast('syncCompleted', msg.successfully);
} else if (msg.command === 'syncStarted') {
@@ -38,13 +38,16 @@ export class MainController implements ng.IController {
}
$state.go('home');
});
} else if (msg.command === 'collectPageDetailsResponse' && msg.sender === 'currentController') {
} else if (msg.command === 'collectPageDetailsResponse' &&
msg.sender === 'currentController') {
$scope.$broadcast('collectPageDetailsResponse', {
frameId: sender.frameId,
tab: msg.tab,
details: msg.details,
});
}
});
};
BrowserApi.messageListener($window.bitwardenPopupMainMessageListener);
}
}