refactor: 💡 Delete jQuery and refactor handler

Delete jQuery from desktop client and refactor the handler using a
native electron way.
This commit is contained in:
Carlos Alcaide committed 2021-07-23 14:38:26 -07:00
1 parent e73cd828a5
commit f5b80f93d2
4 files changed
+7 -28

No files matched your search

-13
View File
@@ -1,5 +1,4 @@
import Route from '@ember/routing/route';
import jQuery from 'jquery';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { A } from '@ember/array';
@@ -31,18 +30,6 @@ export default class ApplicationRoute extends Route {
return this.origin.updateOrigin();
}
/**
* Adds listener on target=_blank links so that they may be opened in an
* external browser.
*/
afterModel() {
const ipc = this.ipc;
/* eslint-disable-next-line ember/no-jquery */
jQuery(document).on('click', 'a[href][target="_blank"]', function () {
ipc.invoke('openExternal', this.href);
});
}
/**
* Add OS config on controller
*/
+6 -1
View File
@@ -12,6 +12,7 @@ const {
BrowserWindow,
Menu,
MenuItem,
shell,
} = require('electron');
require('./ipc/handlers.js');
@@ -166,9 +167,13 @@ app.on('ready', async () => {
/* eng-disable LIMIT_NAVIGATION_JS_CHECK */
if (!url.startsWith('serve://boundary')) event.preventDefault();
});
// Also opens links with target="_blank" in a browser window
mainWindow.webContents.on('new-window', (event, url) => {
/* eng-disable LIMIT_NAVIGATION_JS_CHECK */
if (!url.startsWith('serve://boundary')) event.preventDefault();
if (!url.startsWith('serve://boundary')) {
event.preventDefault();
shell.openExternal(url);
}
});
mainWindow.on('unresponsive', () => {
-1
View File
@@ -49,7 +49,6 @@
},
"devDependencies": {
"@doyensec/electronegativity": "^1.8.1",
"@ember/jquery": "^1.1.0",
"@ember/optional-features": "^2.0.0",
"@ember/render-modifiers": "^1.0.2",
"@ember/test-helpers": "^2.2.8",
+1 -13
View File
@@ -1753,18 +1753,6 @@
resolved "https://registry.yarnpkg.com/@ember/edition-utils/-/edition-utils-1.2.0.tgz#a039f542dc14c8e8299c81cd5abba95e2459cfa6"
integrity sha512-VmVq/8saCaPdesQmftPqbFtxJWrzxNGSQ+e8x8LLe3Hjm36pJ04Q8LeORGZkAeOhldoUX9seLGmSaHeXkIqoog==
"@ember/jquery@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@ember/jquery/-/jquery-1.1.0.tgz#33d062610a5ceaa5c5c8a3187f870d47d6595940"
integrity sha512-zePT3LiK4/2bS4xafrbOlwoLJrDFseOZ95OOuVDyswv8RjFL+9lar+uxX6+jxRb0w900BcQSWP/4nuFSK6HXXw==
dependencies:
broccoli-funnel "^2.0.2"
broccoli-merge-trees "^3.0.2"
ember-cli-babel "^7.11.1"
ember-cli-version-checker "^3.1.3"
jquery "^3.4.1"
resolve "^1.11.1"
"@ember/optional-features@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@ember/optional-features/-/optional-features-2.0.0.tgz#c809abd5a27d5b0ef3c6de3941334ab6153313f0"
@@ -13497,7 +13485,7 @@ joi@^12.0.0:
isemail "3.x.x"
topo "2.x.x"
jquery@^3.4.1, jquery@^3.5.0:
jquery@^3.5.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.0.tgz#c72a09f15c1bdce142f49dbf1170bdf8adac2470"
integrity sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==