Closed cancan101 closed 1 year ago
I guess either way, it's an improvement, so why not merge it :smile:
FWIW, I am not sure this has worked recently:
gmail.observe.on("view_thread", (domThread) => {
console.log("Looking at thread:", domThread);
const threadData = gmail.new.get.thread_data(domThread);
console.log("Thread data:", threadData); // reports null!
}
I have:
gmail.observe.on('view_thread', function (obj) {
console.log('view_thread', obj);
const threadJQElem = obj.dom();
const threadElem = threadJQElem[0].querySelector<HTMLElement>(
'[data-thread-perm-id]'
);
if (threadElem) {
const threadId: string | undefined = threadElem.dataset['threadPermId'];
if (threadId) {
const threadData = gmail.new.get.thread_data(threadId);
console.log('view_thread. obj:', obj, threadId, threadData);
// ....
}
}
});
Oh well. It works with email, so IMO it should work with threads too for API consistency.
But that's another issue.
Testing that almost kinda works, but not completely.
If you do like this, this kinda works:
But if you try to chain it into
gmail.new.get.thread_data()
it seems to fail:Not sure if fixing that is within the scope of this PR or not though.