File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,35 @@ import '@github/remote-input-element'
30
30
<div id =" md-preview" ></div >
31
31
```
32
32
33
+ ### Styling loading state
34
+
35
+ ` [loading] ` attribute will be added to ` <remote-input> ` when a network request is kicked off, and removed when it ends.
36
+
37
+ ``` css
38
+ .loading-icon { display : none ; }
39
+ remote-input [loading ] .loading-icon { display : inline ; }
40
+ ```
41
+
42
+ ### Events
43
+
44
+ ``` js
45
+ const remoteInput = document .querySelector (' remote-input' )
46
+
47
+ // Network request lifecycle events.
48
+ remoteInput .addEventListener (' loadstart' , function (event ) {
49
+ console .log (' Network request started' , event )
50
+ })
51
+ remoteInput .addEventListener (' loadend' , function (event ) {
52
+ console .log (' Network request complete' , event )
53
+ })
54
+ remoteInput .addEventListener (' load' , function (event ) {
55
+ console .log (' Network request succeeded' , event )
56
+ })
57
+ remoteInput .addEventListener (' error' , function (event ) {
58
+ console .log (' Network request failed' , event )
59
+ })
60
+ ```
61
+
33
62
## Browser support
34
63
35
64
Browsers without native [ custom element support] [ support ] require a [ polyfill] [ ] .
You can’t perform that action at this time.
0 commit comments