tagu-tagu 3.3.1 → 3.3.2
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 +15 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -149,6 +149,20 @@ function OnExample() {
|
|
|
149
149
|
document.body.appendChild(OnExample());
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
+
#### `data` initializer
|
|
153
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/9cLtyzkm/1/)
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { div, waitForData } from "tagu-tagu";
|
|
157
|
+
|
|
158
|
+
function DataExample() {
|
|
159
|
+
return div({ data: { "my-data-key": "Hello World!" } });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const element = DataExample();
|
|
163
|
+
console.log(await waitForData(element, "my-data-key")); // Hello World!
|
|
164
|
+
```
|
|
165
|
+
|
|
152
166
|
#### Modify existing element
|
|
153
167
|
You can use initializers for existing element.
|
|
154
168
|
[JSFiddle](https://jsfiddle.net/do_the_simplest/o87nw6zL/15/)
|
|
@@ -170,6 +184,7 @@ Modify(document.body, {
|
|
|
170
184
|
|
|
171
185
|
```
|
|
172
186
|
|
|
187
|
+
|
|
173
188
|
#### `$` initializer
|
|
174
189
|
[JSFiddle](https://jsfiddle.net/do_the_simplest/b8roj7wx/1/)
|
|
175
190
|
```html
|
|
@@ -271,21 +286,6 @@ function InitializerCallbackExample() {
|
|
|
271
286
|
|
|
272
287
|
document.body.appendChild(InitializerCallbackExample());
|
|
273
288
|
```
|
|
274
|
-
|
|
275
|
-
#### Data initializer
|
|
276
|
-
[JSFiddle](https://jsfiddle.net/do_the_simplest/9cLtyzkm/1/)
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
import { div, waitForData } from "tagu-tagu";
|
|
280
|
-
|
|
281
|
-
function DataExample() {
|
|
282
|
-
return div({ data: { "my-data-key": "Hello World!" } });
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const element = DataExample();
|
|
286
|
-
console.log(await waitForData(element, "my-data-key")); // Hello World!
|
|
287
|
-
```
|
|
288
|
-
|
|
289
289
|
### `If`
|
|
290
290
|
[JSFiddle](https://jsfiddle.net/do_the_simplest/bxuqsh1d/19/)
|
|
291
291
|
|