Skip to content

Commit 45b4fff

Browse files
committed
Spike out quick reference
1 parent 93162d1 commit 45b4fff

File tree

3 files changed

+148
-0
lines changed

3 files changed

+148
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!-- aka "cheatsheet": no (or minimal) explanation, no fluff -->
2+
3+
## Counter Component
4+
5+
<!--
6+
TODO:
7+
- Implement <Sample>
8+
- Renders code snippet from file
9+
- Invokes <REPL> with the code snippet
10+
-->
11+
<Sample @code="quick-reference/counter.gjs" />
12+
13+
## if
14+
15+
## if else
16+
17+
## inline if
18+
19+
## inline if else
20+
21+
## unless
22+
23+
## unless else
24+
25+
## inline unless
26+
27+
## inline unless else
28+
29+
## let
30+
31+
## each
32+
33+
## keyed each
34+
35+
## each-in
36+
37+
## keyed each-in
38+
39+
## in-element
40+
41+
<!-- aka portalling -->
42+
43+
## yield
44+
45+
<!-- aka "block" aka "slot" -->
46+
47+
## yield to="name"
48+
49+
<!-- aka "named block" aka "named slot" -->
50+
51+
## modifier
52+
53+
<!-- aka "partial application of a modifier" aka "currying a modifier" -->
54+
55+
## component
56+
57+
<!-- aka "partial application of a component" aka "currying a component" -->
58+
59+
## component for attributes and modifiers
60+
61+
<!-- aka "partial application of a component" aka "currying a component" -->
62+
63+
## helper
64+
65+
<!-- aka "partial application of a helper" aka "currying a helper" -->
66+
67+
## fn
68+
69+
<!-- aka "partial application of a function" aka "currying a function" -->
70+
71+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
In [RFC #1070](https://github.com/emberjs/rfcs/pull/1070), we defined a set of criteria to allow many of the platform native utilities to be used directly within the `<template>...</template>` region of components.
2+
3+
<details><summary>That criteria may be viewed here</summary>
4+
5+
Criteria for inclusion in this list:
6+
7+
Any of:
8+
- begins with an uppercase letter
9+
- guaranteed to never be added to glimmer as a keyword (e.g.: globalThis)
10+
11+
And:
12+
- must not need new to invoke
13+
- must not require lifetime management (e.g.: setTimeout)
14+
- must not be a single-word lower-case API, because of potential collision with future new HTML elements
15+
- if the API is a function, the return value should not be a promise
16+
- must be one one of these lists:
17+
- https://tc39.es/ecma262/#sec-global-object
18+
- https://tc39.es/ecma262/#sec-function-properties-of-the-global-object
19+
- https://html.spec.whatwg.org/multipage/nav-history-apis.html#window
20+
- https://html.spec.whatwg.org/multipage/indices.html#all-interfaces
21+
- https://html.spec.whatwg.org/multipage/webappapis.html
22+
23+
</details>
24+
25+
## TC39
26+
27+
### `globalThis`
28+
### `Atomics`
29+
### `JSON`
30+
### `Math`
31+
### `Reflect`
32+
33+
### `isNaN`
34+
### `isFinite`
35+
### `parseInt`
36+
### `parseFloat`
37+
### `decodeURI`
38+
### `decodeURIComponent`
39+
### `encodeURI`
40+
### `encodeURIComponent`
41+
42+
### `Array`
43+
### `BigInt`
44+
### `Boolean`
45+
### `Date`
46+
### `Number`
47+
### `Object`
48+
### `String`
49+
50+
### `Infinity`
51+
### `NaN`
52+
53+
## WHATWG
54+
55+
### `localStorage`
56+
### `sessionStorage`
57+
### `URL`
58+
59+
### `postMessage`
60+
### `structuredClone`
61+
62+
### `isSecureContext`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Component from '@glimmer/component';
2+
import { tracked } from '@glimmer/tracking';
3+
import { on } from '@ember/modifier';
4+
5+
export default class HelloWorld extends Component {
6+
@tracked count = 0;
7+
8+
increment = () => this.count += 1;
9+
10+
<template>
11+
<p>You have clicked the button {{this.count}} times.</p>
12+
13+
<button type="button" {{on "click" this.increment}}>Click</button>
14+
</template>
15+
}

0 commit comments

Comments
 (0)