@substrate-system/tonic 16.0.5 → 16.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/dist/tonic.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,11 @@ The tl;dr is that this allows you to pass full JS objects between components, no
|
|
|
30
30
|
- [Install](#install)
|
|
31
31
|
- [Use](#use)
|
|
32
32
|
- [fork](#fork)
|
|
33
|
-
* [
|
|
33
|
+
* [types](#types)
|
|
34
|
+
* [`tag`](#tag)
|
|
35
|
+
* [`emit`](#emit)
|
|
36
|
+
* [`static event`](#static-event)
|
|
37
|
+
* [`dispatch`](#dispatch)
|
|
34
38
|
- [Useful links](#useful-links)
|
|
35
39
|
|
|
36
40
|
<!-- tocstop -->
|
|
@@ -91,13 +95,10 @@ This is a fork of [@socketsupply/tonic](https://github.com/socketsupply/tonic).
|
|
|
91
95
|
|
|
92
96
|
See [API docs](https://substrate-system.github.io/tonic/).
|
|
93
97
|
|
|
94
|
-
###
|
|
95
|
-
Things added to the forked version:
|
|
96
|
-
|
|
97
|
-
#### types
|
|
98
|
+
### types
|
|
98
99
|
See [src/index.ts](./src/index.ts).
|
|
99
100
|
|
|
100
|
-
|
|
101
|
+
### `tag`
|
|
101
102
|
Get the HTML tag name given a Tonic class.
|
|
102
103
|
|
|
103
104
|
```ts
|
|
@@ -115,7 +116,7 @@ ExampleTwo.tag
|
|
|
115
116
|
// => 'example-two'
|
|
116
117
|
```
|
|
117
118
|
|
|
118
|
-
|
|
119
|
+
### `emit`
|
|
119
120
|
Emit namespaced events, following a naming convention. The return value is the call to [element.dispatchEvent()](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent).
|
|
120
121
|
|
|
121
122
|
Given an event name, the dispatched event will be prefixed with the element name, for example, `my-element:event-name`.
|
|
@@ -127,7 +128,7 @@ emit (type:string, detail:string|object|any[] = {}, opts:Partial<{
|
|
|
127
128
|
}> = {}):boolean
|
|
128
129
|
```
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
#### emit example
|
|
131
132
|
|
|
132
133
|
```js
|
|
133
134
|
class EventsExample extends Tonic {
|
|
@@ -154,7 +155,7 @@ el.emit('more testing', 'some data', {
|
|
|
154
155
|
})
|
|
155
156
|
```
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
### `static event`
|
|
158
159
|
Return the namespaced event name given a string.
|
|
159
160
|
|
|
160
161
|
```ts
|
|
@@ -165,7 +166,7 @@ class {
|
|
|
165
166
|
}
|
|
166
167
|
```
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
#### example
|
|
169
170
|
```js
|
|
170
171
|
class EventsExample extends Tonic {
|
|
171
172
|
// ...
|
|
@@ -175,7 +176,7 @@ EventsExample.event('testing')
|
|
|
175
176
|
// => 'events-example:testing'
|
|
176
177
|
```
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
### `dispatch`
|
|
179
180
|
Emit a regular, non-namespaced event.
|
|
180
181
|
|
|
181
182
|
```ts
|
|
@@ -184,7 +185,7 @@ Emit a regular, non-namespaced event.
|
|
|
184
185
|
}
|
|
185
186
|
```
|
|
186
187
|
|
|
187
|
-
|
|
188
|
+
#### `dispatch` example
|
|
188
189
|
|
|
189
190
|
```js
|
|
190
191
|
class EventsExample extends Tonic {
|
package/dist/tonic.js
CHANGED