[chrome-gnome-shell/feature/extensions_sync] Added a few comments
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chrome-gnome-shell/feature/extensions_sync] Added a few comments
- Date: Thu, 11 Aug 2016 10:09:27 +0000 (UTC)
commit d799d8af0b128a8836a2f221fc1a76ed046d2b8e
Author: Yuri Konotopov <ykonotopov gmail com>
Date: Thu Aug 11 12:15:03 2016 +0300
Added a few comments
extension/extension.js | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/extension/extension.js b/extension/extension.js
index a37b2e7..54272c5 100644
--- a/extension/extension.js
+++ b/extension/extension.js
@@ -69,15 +69,24 @@ chrome.runtime.onMessageExternal.addListener(function (request, sender, sendResp
var lastPortMessage = {message: null, date: 0};
var port = chrome.runtime.connectNative(NATIVE_HOST);
+/*
+ * Native host messaging events handler.
+ */
port.onMessage.addListener(function (message) {
if (message && message.signal && [SIGNAL_EXTENSION_CHANGED,
SIGNAL_SHELL_APPEARED].indexOf(message.signal) !== -1)
{
+ /*
+ * Skip duplicate events. This is happens eg when extension is installed.
+ */
if((new Date().getTime()) - lastPortMessage.date < 500 && GSC.isSignalsEqual(message,
lastPortMessage.message))
{
lastPortMessage.date = new Date().getTime();
return;
}
+ /*
+ * Send events to opened extensions.gnome.org tabs
+ */
chrome.tabs.query({
url: EXTENSIONS_WEBSITE + '*'
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]