Search code examples
inboxsdk

Get composer window id when a composerView is fired in InboxSDK


I am using inboxSDK to create a gmail google chrome extension.

I want to get the current composer window id (the html id attribute) when the composer view is opened.

Like this:

sdk.Compose.registerComposeViewHandler(function(composeView){
    var window_id = how?
    ...

What did I think about?

I thought about using addbutton() to add a button with a specified unique id.

Then use javascript to traverse up the DOM until the div with the composer class is found and fetch its id.

Then destroy the added button.

But I wonder if there is a simpler approach.


Solution

  • composeView.getElement() returns the element of the compose window.

    So you can just do composeView.getElement().id