I am using javascript to create 2 messages that I am sending from my CI program to my Chrome Extension. This is the first one that seems to run fine. I am calling it from a method in one of my controllers. The message snapshot_mode is correctly sent to the Chrome Extension.
Code:
<script language="javascript">
$(document).ready( function() {
var editorExtensionId = "lamacgnkfoiknjpleghfknfigbmhdaei";
// Make a simple request:
chrome.runtime.sendMessage(editorExtensionId, "snapshot_mode",
function (response) {
if (!response.success)
handleError(url);
}
)
})
</script>
Later, when the user logs off the application I am calling this from a different function in the same controller:
Code:
<script language="javascript">
var editorExtensionId = "lamacgnkfoiknjpleghfknfigbmhdaei";
// Make a simple request:
chrome.runtime.sendMessage(editorExtensionId, "snapshot_mode_unload",
function (response) {
if (!response.success)
handleError(url);
}
)
</script>
Almost exactly the same, right? The unload doesn't work. I haven't been able to debug the javascript code in phpStorm, but I know that the message is not arriving at the Extension. It is true in the code that shortly after calling the unload function above, I am clearing the session and then redirecting. Without debugging both the php and javascript at the same time, how can I solve this problem?
proof that an old dog can learn new tricks