signal-desktop/js/index.js
lilia 06e53871b2 Fix blank window after unlink
Don't wait for background init before rendering inbox.

If the client detects that it has become unlinked, it will not call
`init()`, never fire the deferredInit, and never render the inbox,
but we want to allow users access to their local messages even if they
have (perhaps temporarily) unlinked the desktop client.

Also, prefer not to extend Backbone.Model until/unless we really need
it.

// FREEBIE
2017-04-10 12:43:14 -07:00

30 lines
792 B
JavaScript

/*global $, Whisper, Backbone, textsecure, extension*/
/*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
function logError(error) {
extension.windows.getBackground(function(bg) {
bg.console.log('index.html: ', error);
});
}
window.onerror = function(message, script, line, col, error) {
logError(error);
};
function render() {
extension.windows.getBackground(function(bg) {
bg.owsDesktopApp.getAppView(window).then(function(appView) {
var bodyEl = document.getElementById('signal-container');
bodyEl.innerHTML = "";
bodyEl.append(appView.el);
});
});
}
window.addEventListener('onreload', render);
render();
}());