mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
parent
e53ceb6bc1
commit
8bed073f20
@ -30,8 +30,8 @@ console.warn('ATTENTION: In an effort to improve user privacy, MetaMask ' +
|
||||
* @param {boolean} remove - removes this handler after being triggered
|
||||
*/
|
||||
function onMessage(messageType, handler, remove) {
|
||||
window.addEventListener('message', function ({ data: { type } }) {
|
||||
if (type !== messageType) { return }
|
||||
window.addEventListener('message', function ({ data }) {
|
||||
if (!data || data.type !== messageType) { return }
|
||||
remove && window.removeEventListener('message', handler)
|
||||
handler.apply(window, arguments)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user