Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept Promise<Target> #193

Closed
fregante opened this issue Jan 18, 2024 · 0 comments · Fixed by #194
Closed

Accept Promise<Target> #193

fregante opened this issue Jan 18, 2024 · 0 comments · Fixed by #194
Labels
enhancement New feature or request

Comments

@fregante
Copy link
Contributor

fregante commented Jan 18, 2024

Targeting the sidebar from the content script requires knowing its own tabId. That is currently still only possible by asking the runtime. This means we can't define a static target like before:

const target = { page: "/sidebar.html" };

+ // Potential race condition
+ void getThisFrame().then((frame) => {
+   target.page += "?tabId=" + frame.tabId;
+});

const sidebarInThisTab = {
  renderPanels: getMethod("SIDEBAR_RENDER_PANELS", target),
// etc

With this change, it would be possible to write:

const target = getThisFrame().then((frame) => ({ page: "/sidebar.html?tabId=" + frame.tabId })

const sidebarInThisTab = {
  renderPanels: getMethod("SIDEBAR_RENDER_PANELS", target),
// etc

Related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant