chrome.tabs.detectLanguage(integer tabId, function callback)
function(language);
function(tabId, language);
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/w5u6vahwb7wJ.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
--
You can get get the equivalent behavior by using bind (https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind) with your callback, so that it gets a copy of the tabId parameter:chrome.tabs.detectLanguage(tabId,(function(tabId, language) {...}).bind(this, tabId));Mihai
On Tue, May 15, 2012 at 4:52 PM, Ziyuan Yao <yaoz...@gmail.com> wrote:
According to this API's documentation (http://code.google.com/chrome/extensions/tabs.html#method-detectLanguage), the API is:chrome.tabs.detectLanguage(integer tabId, function callback)And the callback is:function(language);
Suppose I have multiple tabs whose content scripts all request the background page to tell the language code for each of these tabs, and when the callback function is called, the code will know the language code but not which tab this language code is for. I think it at least should have another parameter:function(tabId, language);
Shouldn't it?
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/w5u6vahwb7wJ.
To post to this group, send email to chromium-extensions@chromium.org.
To unsubscribe from this group, send email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
To unsubscribe from this group, send email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
To unsubscribe from this group, send email to chromium-extensions+unsub...@chromium.org.
You can get get the equivalent behavior by using bind (https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind) with your callback, so that it gets a copy of the tabId parameter:chrome.tabs.detectLanguage(tabId,(function(tabId, language) {...}).bind(this, tabId));Mihai
On Tue, May 15, 2012 at 4:52 PM, Ziyuan Yao <yaoz...@gmail.com> wrote:
According to this API's documentation (http://code.google.com/chrome/extensions/tabs.html#method-detectLanguage), the API is:chrome.tabs.detectLanguage(integer tabId, function callback)And the callback is:function(language);
Suppose I have multiple tabs whose content scripts all request the background page to tell the language code for each of these tabs, and when the callback function is called, the code will know the language code but not which tab this language code is for. I think it at least should have another parameter:function(tabId, language);
Shouldn't it?
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/w5u6vahwb7wJ.
To post to this group, send email to chromium-extensions@chromium.org.
To unsubscribe from this group, send email to chromium-extensions+unsub...@chromium.org.