Skip to content

Commit

Permalink
fix 33
Browse files Browse the repository at this point in the history
  • Loading branch information
iniznet committed Oct 21, 2023
1 parent d66fcc1 commit 467c51d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 36 deletions.
15 changes: 5 additions & 10 deletions dist/async-alpine.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ __export(strategies_exports, {
});

// src/core/strategies/eager.js
var eager = () => {
var eager_default = () => {
return true;
};
var eager_default = eager;

// src/core/strategies/event.js
var event = ({ component, argument }) => {
var event_default = ({ component, argument }) => {
return new Promise((resolve) => {
if (argument) {
window.addEventListener(argument, () => resolve(), { once: true });
Expand All @@ -43,10 +42,9 @@ var event = ({ component, argument }) => {
}
});
};
var event_default = event;

// src/core/strategies/idle.js
var idle = () => {
var idle_default = () => {
return new Promise((resolve) => {
if ("requestIdleCallback" in window) {
window.requestIdleCallback(resolve);
Expand All @@ -55,10 +53,9 @@ var idle = () => {
}
});
};
var idle_default = idle;

// src/core/strategies/media.js
var media = ({ argument }) => {
var media_default = ({ argument }) => {
return new Promise((resolve) => {
if (!argument) {
console.log("Async Alpine: media strategy requires a media query. Treating as 'eager'");
Expand All @@ -72,10 +69,9 @@ var media = ({ argument }) => {
}
});
};
var media_default = media;

// src/core/strategies/visible.js
var visible = ({ component, argument }) => {
var visible_default = ({ component, argument }) => {
return new Promise((resolve) => {
const rootMargin = argument || "0px 0px 0px 0px";
const observer = new IntersectionObserver((entries) => {
Expand All @@ -87,7 +83,6 @@ var visible = ({ component, argument }) => {
observer.observe(component.el);
});
};
var visible_default = visible;

// src/core/requirement-parser.js
function parseRequirements(expression) {
Expand Down
15 changes: 5 additions & 10 deletions dist/async-alpine.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ __export(strategies_exports, {
});

// src/core/strategies/eager.js
var eager = () => {
var eager_default = () => {
return true;
};
var eager_default = eager;

// src/core/strategies/event.js
var event = ({ component, argument }) => {
var event_default = ({ component, argument }) => {
return new Promise((resolve) => {
if (argument) {
window.addEventListener(argument, () => resolve(), { once: true });
Expand All @@ -38,10 +37,9 @@ var event = ({ component, argument }) => {
}
});
};
var event_default = event;

// src/core/strategies/idle.js
var idle = () => {
var idle_default = () => {
return new Promise((resolve) => {
if ("requestIdleCallback" in window) {
window.requestIdleCallback(resolve);
Expand All @@ -50,10 +48,9 @@ var idle = () => {
}
});
};
var idle_default = idle;

// src/core/strategies/media.js
var media = ({ argument }) => {
var media_default = ({ argument }) => {
return new Promise((resolve) => {
if (!argument) {
console.log("Async Alpine: media strategy requires a media query. Treating as 'eager'");
Expand All @@ -67,10 +64,9 @@ var media = ({ argument }) => {
}
});
};
var media_default = media;

// src/core/strategies/visible.js
var visible = ({ component, argument }) => {
var visible_default = ({ component, argument }) => {
return new Promise((resolve) => {
const rootMargin = argument || "0px 0px 0px 0px";
const observer = new IntersectionObserver((entries) => {
Expand All @@ -82,7 +78,6 @@ var visible = ({ component, argument }) => {
observer.observe(component.el);
});
};
var visible_default = visible;

// src/core/requirement-parser.js
function parseRequirements(expression) {
Expand Down
2 changes: 1 addition & 1 deletion dist/async-alpine.script.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions src/core/strategies/eager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// not really necessary but keeps the logic consistant
const eager = () => {
export default () => {
return true;
};

export default eager;
4 changes: 1 addition & 3 deletions src/core/strategies/event.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const event = ({ component, argument }) => {
export default ({ component, argument }) => {
return new Promise(resolve => {
if (argument) {
// if there's an argument use that as a custom event name
Expand All @@ -19,5 +19,3 @@ const event = ({ component, argument }) => {
}
});
};

export default event;
4 changes: 1 addition & 3 deletions src/core/strategies/idle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const idle = () => {
export default () => {
return new Promise(resolve => {
if ('requestIdleCallback' in window) {
window.requestIdleCallback(resolve);
Expand All @@ -7,5 +7,3 @@ const idle = () => {
}
});
};

export default idle;
4 changes: 1 addition & 3 deletions src/core/strategies/media.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const media = ({ argument }) => {
export default ({ argument }) => {
return new Promise(resolve => {
if (!argument) {
// eslint-disable-next-line no-console
Expand All @@ -14,5 +14,3 @@ const media = ({ argument }) => {
}
});
};

export default media;
4 changes: 1 addition & 3 deletions src/core/strategies/visible.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const visible = ({ component, argument }) => {
export default ({ component, argument }) => {
return new Promise(resolve => {
// work out if a rootMargin has been specified, and if so take it from the requirement
const rootMargin = argument || '0px 0px 0px 0px';
Expand All @@ -11,5 +11,3 @@ const visible = ({ component, argument }) => {
observer.observe(component.el);
});
};

export default visible;

0 comments on commit 467c51d

Please sign in to comment.