Skip to content

Commit

Permalink
Removed unnecessary callback
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Feb 14, 2021
1 parent a332574 commit 8b69c82
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions packages/altair-electron/src/app/window.js
Expand Up @@ -205,26 +205,22 @@ class WindowManager {

registerProtocol() {

try {
/**
* Using a custom buffer protocol, instead of a file protocol because of restrictions with the file protocol.
*/
protocol.registerBufferProtocol('altair', (request, callback) => {

const requestDirectory = getDistDirectory();
const originalFilePath = path.join(requestDirectory, new url.URL(request.url).pathname);
const indexPath = path.join(requestDirectory, 'index.html');

this.getFileContentData(originalFilePath, indexPath).then(({ mimeType, data }) => {
callback({ mimeType, data });
}).catch(err => {
throw err;
});
/**
* Using a custom buffer protocol, instead of a file protocol because of restrictions with the file protocol.
*/
protocol.registerBufferProtocol('altair', (request, callback) => {

const requestDirectory = getDistDirectory();
const originalFilePath = path.join(requestDirectory, new url.URL(request.url).pathname);
const indexPath = path.join(requestDirectory, 'index.html');

this.getFileContentData(originalFilePath, indexPath).then(({ mimeType, data }) => {
callback({ mimeType, data });
}).catch(error => {
error.message = `Failed to register protocol. ${error.message}`;
console.error(error);
});
} catch (error) {
error.message = `Failed to register protocol. ${error.message}`;
console.error(error);
}
});
}

/**
Expand Down

0 comments on commit 8b69c82

Please sign in to comment.