Abstract nativeclient callback logic

The nativeclient.js module overrides
window.textsecure.registerOnLoadFunction with its own version. Otherwise
helpers will define a trivial placeholder for same.

The flag textsecure.NATIVE_CLIENT can be set anywhere ahead of
nativeclient.js, but is only acted on in nativeclient.js,
and crypto.js.
This commit is contained in:
lilia
2014-11-06 17:01:56 -08:00
parent 69c52d51b3
commit 0a3c03025b
2 changed files with 8 additions and 15 deletions

View File

@@ -16,6 +16,11 @@
;(function() {
'use strict';
window.textsecure = window.textsecure || {};
window.textsecure.NATIVE_CLIENT = window.textsecure.NATIVE_CLIENT || true;
if (!textsecure.NATIVE_CLIENT) {
window.textsecure.registerOnLoadFunction = window.textsecure.nativeclient.registerOnLoadFunction;
}
var naclMessageNextId = 0;
var naclMessageIdCallbackMap = {};