[rst-commit] r180 - in /redwax-signtext-firefox/trunk: ChangeLog background.js
rst-commit at redwax.eu
rst-commit at redwax.eu
Mon Jul 8 14:57:59 CEST 2024
Author: minfrin at redwax.eu
Date: Mon Jul 8 14:57:59 2024
New Revision: 180
Log:
Distinguish between the native app having handled at least
one message and disconnected, and the native app not having
been installed at all.
Modified:
redwax-signtext-firefox/trunk/ChangeLog
redwax-signtext-firefox/trunk/background.js
Modified: redwax-signtext-firefox/trunk/ChangeLog
==============================================================================
--- redwax-signtext-firefox/trunk/ChangeLog (original)
+++ redwax-signtext-firefox/trunk/ChangeLog Mon Jul 8 14:57:59 2024
@@ -1,3 +1,9 @@
+
+Changes with v0.9.5
+
+ *) Distinguish between the native app having handled at least
+ one message and disconnected, and the native app not having
+ been installed at all. [Grahamm Leggett]
Changes with v0.9.4
Modified: redwax-signtext-firefox/trunk/background.js
==============================================================================
--- redwax-signtext-firefox/trunk/background.js (original)
+++ redwax-signtext-firefox/trunk/background.js Mon Jul 8 14:57:59 2024
@@ -2,11 +2,13 @@
console.log('Redwax SignText: background started');
var csPorts = [];
-//var nativePort = undefined;
+var count = 0;
function nativeMessaged(m) {
console.log('Redwax SignText: background: message received from native: ', m);
+
+ count++;
/*
* Native message response is handled here. Send the message
@@ -29,16 +31,20 @@
function nativeDisconnected(p) {
- window.nativePort.onMessage.removeListener(nativeMessaged);
- window.nativePort.onDisconnect.removeListener(nativeDisconnected);
+ window.nativePort.onMessage.removeListener(nativeMessaged);
+ window.nativePort.onDisconnect.removeListener(nativeDisconnected);
-// window.nativePort.disconnect();
window.nativePort = undefined;
window.csPorts.forEach(cp => {
- cp.postMessage({ error: 'error:nativeDisconnected', exception: p.error.message });
+ if (count) {
+ cp.postMessage({ error: 'error:nativeDisconnected', exception: p.error.message });
+ }
+ else {
+ cp.postMessage({ error: 'error:nativeMissing', exception: p.error.message });
+ }
});
- console.log('Redwax SignText: native port disconnected.');
+ console.log('Redwax SignText: native port disconnected: ', p.error.message);
}
function connected(p) {
More information about the rst-commit
mailing list