Remove a use of jquery that was causing some ugly.
This commit is contained in:
@@ -63,8 +63,9 @@ Cosmopolite.prototype.shutdown = function() {
|
|||||||
this.socket_ = null;
|
this.socket_ = null;
|
||||||
socket.close();
|
socket.close();
|
||||||
}
|
}
|
||||||
if (this.$) {
|
if (this.messageHandler_) {
|
||||||
this.$('window').off('message');
|
window.removeEventListener('message', this.messageHandler_);
|
||||||
|
this.messageHandler_ = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -212,15 +213,15 @@ Cosmopolite.prototype.onReceiveMessage_ = function(data) {
|
|||||||
* messages are normal.
|
* messages are normal.
|
||||||
*/
|
*/
|
||||||
Cosmopolite.prototype.registerMessageHandlers_ = function() {
|
Cosmopolite.prototype.registerMessageHandlers_ = function() {
|
||||||
this.$(window).on('message', this.$.proxy(function(e) {
|
this.messageHandler_ = function(e) {
|
||||||
if (e.originalEvent.origin != window.location.origin) {
|
if (e.origin != window.location.origin) {
|
||||||
console.log(
|
console.log('cosmopolite: received message from bad origin:', e.origin);
|
||||||
'cosmopolite: received message from bad origin:', e.originalEvent.origin);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('cosmopolite: received browser message:', e.originalEvent.data);
|
console.log('cosmopolite: received browser message:', e.data);
|
||||||
this.onReceiveMessage_(e.originalEvent.data);
|
this.onReceiveMessage_(e.data);
|
||||||
}, this));
|
}.bind(this);
|
||||||
|
window.addEventListener('message', this.messageHandler_);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user