Make getBackground async
This commit is contained in:
parent
a57363f1c0
commit
76e170686a
6 changed files with 198 additions and 175 deletions
|
@ -20,19 +20,20 @@
|
|||
window.Whisper = window.Whisper || {};
|
||||
|
||||
extension.windows.getCurrent(function (windowInfo) {
|
||||
var bg = extension.windows.getBackground();
|
||||
window.$ = bg.$;
|
||||
var body = $('body', document);
|
||||
var conversation = bg.getConversationForWindow(windowInfo.id);
|
||||
if (conversation) {
|
||||
window.document.title = conversation.getTitle();
|
||||
var view = new bg.Whisper.ConversationView({
|
||||
model: conversation
|
||||
});
|
||||
view.$el.prependTo(body);
|
||||
view.$('input.send-message').focus();
|
||||
} else {
|
||||
$('<div>').text('Error').prependTo(body);
|
||||
}
|
||||
extension.windows.getBackground(function(bg) {
|
||||
window.$ = bg.$;
|
||||
var body = $('body', document);
|
||||
var conversation = bg.getConversationForWindow(windowInfo.id);
|
||||
if (conversation) {
|
||||
window.document.title = conversation.getTitle();
|
||||
var view = new bg.Whisper.ConversationView({
|
||||
model: conversation
|
||||
});
|
||||
view.$el.prependTo(body);
|
||||
view.$('input.send-message').focus();
|
||||
} else {
|
||||
$('<div>').text('Error').prependTo(body);
|
||||
}
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue