fix: make sure to clear out the last file name

This commit is contained in:
iCrawl 2017-11-24 04:49:32 +01:00
parent 9d47c438b4
commit b89abd7b41
No known key found for this signature in database
GPG key ID: E41A6DB922EC2CFE

View file

@ -116,6 +116,8 @@ function destroyRPC(): void {
rpc.destroy(); rpc.destroy();
// Null the RPC variable. // Null the RPC variable.
rpc = null; rpc = null;
// Null the last known file name
lastKnownFileName = null;
} }
// This function updates the activity (The Client's Rich Presence status). // This function updates the activity (The Client's Rich Presence status).
@ -123,7 +125,7 @@ function setActivity(): void {
// Do not continue if RPC isn't initalized. // Do not continue if RPC isn't initalized.
if (!rpc) return; if (!rpc) return;
if (window.activeTextEditor && window.activeTextEditor.document.fileName === lastKnownFileName) return; if (window.activeTextEditor && window.activeTextEditor.document.fileName === lastKnownFileName) return;
lastKnownFileName = window.activeTextEditor ? window.activeTextEditor.document.fileName : ''; lastKnownFileName = window.activeTextEditor ? window.activeTextEditor.document.fileName : null;
// Create a JSON Object with the user's activity information. // Create a JSON Object with the user's activity information.
const activity = { const activity = {