Atom JS

Playground to test features

1. Scope

Everything is scoped in apline js, so you can use the same variable names and it will not conflict with other parts of your applicaion.

The downside of this concept is, that you can't reuse even the logic without any extra doing.

Counter 1.1

Counter 1.2

2. Reuse logic with Alpine.data

With Alpine.data() it possible to reuse the same logic in multiple places. This is particular usefull for complex logic like API requests or complex calculations.

Take a look in the source code to see how it works.

Counter 2.1

Counter 2.2