From 4f7d314135793bf315304d2663df2144441dc33a Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Tue, 29 May 2012 16:36:05 -0700 Subject: Have Function.curry take varargs instead of an array. --- content_scripts/vomnibar.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vomnibar.js b/content_scripts/vomnibar.js index 97f8b1c1..3fedc8c4 100644 --- a/content_scripts/vomnibar.js +++ b/content_scripts/vomnibar.js @@ -195,11 +195,15 @@ var vomnibar = (function() { this.filterPort.onMessage.addListener(function(msg) { if (msg.id != id) return; // The result objects coming from the background page will be of the form: - // { html: "", action: { functionName: "", args: [] } } - // functionName will be either "navigateToUrl" or "switchToTab". args will be a URL or a tab ID. + // { html: "", action: "", url: "" } + // action will be either "navigateToUrl" or "switchToTab". var results = msg.results.map(function(result) { - var functionToCall = completionActions[result.action.functionName]; - result.performAction = functionToCall.curry(result.action.args); + var functionToCall = completionActions[result.action]; + if (result.action == "navigateToUrl") + functionToCall = functionToCall.curry(result.url); + else if (result.action == "switchToTab") + functionToCall = functionToCall.curry(result.tabId); + result.performAction = functionToCall; return result; }); callback(results); -- cgit v1.2.3