1102: Fix inpage listener syntax (#5708) (#5709)

feature/default_network_editable
Noah I 6 years ago committed by Paul Bouchon
parent e53ceb6bc1
commit 8bed073f20
  1. 4
      app/scripts/inpage.js

@ -30,8 +30,8 @@ console.warn('ATTENTION: In an effort to improve user privacy, MetaMask ' +
* @param {boolean} remove - removes this handler after being triggered * @param {boolean} remove - removes this handler after being triggered
*/ */
function onMessage(messageType, handler, remove) { function onMessage(messageType, handler, remove) {
window.addEventListener('message', function ({ data: { type } }) { window.addEventListener('message', function ({ data }) {
if (type !== messageType) { return } if (!data || data.type !== messageType) { return }
remove && window.removeEventListener('message', handler) remove && window.removeEventListener('message', handler)
handler.apply(window, arguments) handler.apply(window, arguments)
}) })

Loading…
Cancel
Save