[chrome-gnome-shell/feature/extensions_sync] Use constants for signals names
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chrome-gnome-shell/feature/extensions_sync] Use constants for signals names
- Date: Thu, 11 Aug 2016 10:08:52 +0000 (UTC)
commit 6f18f0908017cd089223fa6b9c83379bda1a91d9
Author: Yuri Konotopov <ykonotopov gmail com>
Date: Wed Aug 10 19:24:52 2016 +0300
Use constants for signals names
extension/content-script-start.js | 2 +-
extension/extension.js | 2 +-
extension/include/constants.js | 3 +++
3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/extension/content-script-start.js b/extension/content-script-start.js
index e39367d..36a2649 100644
--- a/extension/content-script-start.js
+++ b/extension/content-script-start.js
@@ -61,7 +61,7 @@ chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
if(
sender.id && sender.id === GS_CHROME_ID &&
- request && request.signal && ["ExtensionStatusChanged",
"org.gnome.Shell"].indexOf(request.signal) !== -1)
+ request && request.signal && [SIGNAL_EXTENSIONS_CHANGED,
SIGNAL_SHELL_APPEARED].indexOf(request.signal) !== -1)
{
window.postMessage(
{
diff --git a/extension/extension.js b/extension/extension.js
index 007e6d9..3421ec2 100644
--- a/extension/extension.js
+++ b/extension/extension.js
@@ -69,7 +69,7 @@ chrome.runtime.onMessageExternal.addListener(function (request, sender, sendResp
var port = chrome.runtime.connectNative(NATIVE_HOST);
port.onMessage.addListener(function (message) {
- if (message && message.signal && ["ExtensionStatusChanged",
"org.gnome.Shell"].indexOf(message.signal) !== -1)
+ if (message && message.signal && [SIGNAL_EXTENSIONS_CHANGED,
SIGNAL_SHELL_APPEARED].indexOf(message.signal) !== -1)
{
chrome.tabs.query({
url: EXTENSIONS_WEBSITE + '*'
diff --git a/extension/include/constants.js b/extension/include/constants.js
index 4bc8dc6..8be9447 100644
--- a/extension/include/constants.js
+++ b/extension/include/constants.js
@@ -19,6 +19,9 @@ ALARM_UPDATE_CHECK = 'gs-chrome-update-check';
MESSAGE_NEXT_UPDATE_CHANGED = 'gs-next-update-changed';
+SIGNAL_EXTENSIONS_CHANGED = 'ExtensionStatusChanged';
+SIGNAL_SHELL_APPEARED = 'org.gnome.Shell';
+
NATIVE_HOST = 'io.github.ne0sight.gs_chrome_connector';
EXTENSIONS_WEBSITE = 'https://extensions.gnome.org/';
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]