Skip to content

Commit

Permalink
save and load data-layer-name attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Jul 6, 2023
1 parent 0da63f6 commit 089a05d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function getAttributes (entity) {
if (entity.getAttribute('mixin')) {
elemObj['mixin'] = entity.getAttribute('mixin');
}

if (entity.getAttribute('data-layer-name')) {
elemObj['data-layer-name'] = entity.getAttribute('data-layer-name');
}
const entityComponents = entity.components;

if (entityComponents) {
Expand Down Expand Up @@ -339,6 +341,10 @@ function createEntityFromObj (entityData, parentEl) {
if (entityData.class) {
entity.classList.add(...entityData.class);
}

if (entityData['data-layer-name']) {
entity.setAttribute('data-layer-name', entityData['data-layer-name']);
}

entity.addEventListener('loaded', () => {
// load attributes
Expand Down

0 comments on commit 089a05d

Please sign in to comment.