Skip to content

Commit

Permalink
remove eval
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rudkovskiy authored and r-brown committed Jul 26, 2024
1 parent 18bd9b7 commit 1ebdbf6
Show file tree
Hide file tree
Showing 40 changed files with 523 additions and 591 deletions.
11 changes: 2 additions & 9 deletions plugins/beacons/Beacons.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
* This source code is licensed under the European Union Public License, version 1.2
* located in the LICENSE file
*/
// utils
import domTemplate from '../../src/utils/domTemplate';

// templates
import beaconTpl from './templates/beacon.html';
import beaconTpl from './templates/beacon';

export default class Beacons {
constructor(beacons, options = {}) {
Expand Down Expand Up @@ -246,10 +243,6 @@ export default class Beacons {
return array.map((v, i) => ({ ...v, id: v.id || i }));
}

getBeaconTpl() {
return beaconTpl;
}

createBeaconEl(beacon) {
const data = { ...beacon };

Expand All @@ -260,7 +253,7 @@ export default class Beacons {
}
};

return domTemplate(this.getBeaconTpl(), { beacon: data });
return beaconTpl.call(this, { beacon: data });
}

getEl(selector) {
Expand Down
2 changes: 0 additions & 2 deletions plugins/beacons/templates/beacon.html

This file was deleted.

10 changes: 10 additions & 0 deletions plugins/beacons/templates/beacon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import render from '@/utils/render';

export default ({ beacon }) => {
const { element } = render(`<div class="gc-beacon ${beacon.class}" />`);
element.addEventListener('click', (e) => {
beacon.onClick(e);
});

return element;
};
Loading

0 comments on commit 1ebdbf6

Please sign in to comment.