From 1506c74b57c3a3703f0594b69851780cfa584d63 Mon Sep 17 00:00:00 2001 From: Scott Pigeon Date: Sat, 21 Feb 2015 11:23:33 -0500 Subject: [PATCH] Changed message object --- js/api.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js/api.js b/js/api.js index ba49c4c..f647ba4 100644 --- a/js/api.js +++ b/js/api.js @@ -2,19 +2,18 @@ define([ "command", "settings!api" ], function(command, Settings) { - + //handles sending custom messages based on Caret commands (builds, plugins, etc) var targets = Settings.get("api"); command.on("init:restart", function() { targets = Settings.get("api"); }); - + command.on("api:execute", function(id, c) { if (!id in targets) return c(); var config = targets[id]; - var message = Object.create(config.message); var send = function() { - chrome.runtime.sendMessage(config.id, message, null, function() { + chrome.runtime.sendMessage(config.id, config.message, null, function() { if (chrome.runtime.lastError) { console.error(chrome.runtime.lastError); } @@ -35,7 +34,7 @@ define([ send(); } }); - + //External apps can send messages by matching Caret's command/argument config objects chrome.runtime.onMessageExternal.addListener(function(message, sender, c) { command.fire(message.command, message.argument, c);