Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(template): access global #1790

Merged
merged 14 commits into from Jul 6, 2023
Merged

feat(template): access global #1790

merged 14 commits into from Jul 6, 2023

Conversation

fkleuver
Copy link
Member

@fkleuver fkleuver commented Jul 5, 2023

📖 Description

Resolves #1490

At the moment, it's not convenient to access some frequently used globals in template expressions such as Array, Object, JSON, Math etc... This PR adds a fixed list of globals to be recognized in the template so that applications can access them directly, rather than having to go through JS.

Usage is the same with JS:

<p>Biggest number is : ${Math.max(numbers)}</p>

This is a breaking change, as it'll disable the ability to just reference JSON from view model. If an application runs into breakage, it'll need to be tweaked as $this.JSON....

@fkleuver fkleuver changed the title Expose globals 2 Access global Jul 5, 2023
@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

Merging #1790 (a0108b3) into master (ca0eda7) will increase coverage by 0.01%.
The diff coverage is 97.56%.

@@            Coverage Diff             @@
##           master    #1790      +/-   ##
==========================================
+ Coverage   88.41%   88.43%   +0.01%     
==========================================
  Files         245      245              
  Lines       22301    22335      +34     
  Branches     5180     5191      +11     
==========================================
+ Hits        19718    19751      +33     
- Misses       2583     2584       +1     
Impacted Files Coverage Δ
packages/kernel/src/di.ts 91.72% <ø> (ø)
packages/runtime/src/errors.ts 100.00% <ø> (ø)
packages/runtime/src/binding/ast.eval.ts 91.40% <91.66%> (-0.07%) ⬇️
packages/runtime/src/binding/ast.ts 96.85% <100.00%> (+0.25%) ⬆️
packages/runtime/src/binding/expression-parser.ts 93.94% <100.00%> (+0.08%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bigopon bigopon changed the title Access global feat(template): access global Jul 6, 2023
@bigopon bigopon merged commit 2486b58 into master Jul 6, 2023
28 checks passed
@bigopon bigopon deleted the expose-globals-2 branch July 6, 2023 22:24
AureliaEffect pushed a commit that referenced this pull request Jul 24, 2023
**Features:**

* **compose:** passthrough bindings + support containerless (#1792) ([e8e39a9](e8e39a9))
* **template:** access global (#1790) ([2486b58](2486b58))

**Bug Fixes:**

* **router-lite:** handling slash in parameter value (#1805) ([3fbb698](3fbb698))
* **au-slot:** correctly prepare resources for slotted view (#1802) ([bf1ca4c](bf1ca4c))
* **router-lite:** e2e build ([a1ca36d](a1ca36d))

**Refactorings:**

* **ref:** deprecate view-model.ref and introduce component.ref (#1803) ([97e8dad](97e8dad))
* **text-binding:** always evaluate expressions in strict mode (#1801) ([15acfee](15acfee))
* **router-lite:** query in fragment when using useUrlFragmentHash option (#1794) ([a1ca36d](a1ca36d))
* ***:** bindable property -> name (#1783) ([ca0eda7](ca0eda7))
* **router-lite:** optimize object creation (#1782) ([c1ef0a3](c1ef0a3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Auto recognize commonly used global objects
2 participants