-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpanel.html
executable file
·36 lines (31 loc) · 1.04 KB
/
panel.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
</head>
<body>
<script type="text/javascript">
var token = "";
var twitch = window.Twitch.ext;
twitch.onAuthorized(function(auth) {
token = auth.token;
twitch.rig.log("onAuthorized() fired, received JWT: " + token)
});
twitch.listen('broadcast', function(topic, contentType, message) {
twitch.rig.log("listen() fired, received PubSub message: " + message)
});
function ping() {
twitch.rig.log("button clicked, pinging https://localhost:8081/api/ping")
fetch('https://localhost:8081/api/ping', {
method: 'get',
headers: new Headers({
'Authorization': 'Bearer ' + token,
})
})
}
</script>
<button onclick="ping()">
Ping
</button>
</body>
</html>