Make getBackground async

This commit is contained in:
lilia 2015-05-11 14:22:15 -07:00
parent a57363f1c0
commit 76e170686a
6 changed files with 198 additions and 175 deletions

View file

@ -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);
}
});
});
}());