Skip to content

Commit c52862e

Browse files
[ci] release (next) (#181)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent bdf8467 commit c52862e

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

.changeset/pre.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
"initialVersions": {
55
"corset": "2.4.0"
66
},
7-
"changesets": []
7+
"changesets": [
8+
"stupid-beds-draw"
9+
]
810
}

CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
11
# corset
22

3+
## 2.5.0-next.0
4+
5+
### Minor Changes
6+
7+
- 38ff738: Allow specifying an alternative event target with event-target
8+
9+
This now allows specifying an alternative event target via the new `event-target` property. You can use it like this:
10+
11+
```js
12+
import sheet, { mount } from "https://cdn.corset.dev/v2";
13+
14+
mount(
15+
document,
16+
class {
17+
onpopstate(ev) {
18+
console.log(
19+
`location: ${document.location}, state: ${JSON.stringify(
20+
event.state
21+
)}`
22+
);
23+
}
24+
bind() {
25+
return sheet`
26+
#app {
27+
event: popstate ${this.onpopstate};
28+
event-target: popstate ${window};
29+
}
30+
`;
31+
}
32+
}
33+
);
34+
```
35+
36+
In the above we are able to use a selector to listen to the [popstate](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event) event that is on the window object.
37+
38+
This can also be used with any object that follows the [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) interface:
39+
40+
```js
41+
import sheet, { mount } from "https://cdn.corset.dev/v2";
42+
43+
let target = new EventTarget();
44+
// Now this can be shared around
45+
46+
mount(
47+
document,
48+
class {
49+
bind() {
50+
return sheet`
51+
#app {
52+
event: foo ${() => console.log("foo event occurred!")};
53+
event-target: foo ${target};
54+
}
55+
56+
some-custom-element {
57+
prop: events ${target};
58+
}
59+
`;
60+
}
61+
}
62+
);
63+
```
64+
365
## 2.4.0
466

567
### Minor Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "corset",
3-
"version": "2.4.0",
3+
"version": "2.5.0-next.0",
44
"description": "Declarative DOM binding, without the complexity of JSX/templates.",
55
"type": "module",
66
"main": "./lib/main.js",

0 commit comments

Comments
 (0)