forked from GoogleChrome/samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·55 lines (46 loc) · 1.76 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
feature_name: IndexedDB Observers
chrome_version: 57
feature_id: 5669292892749824
---
<style>
#data, #name {
background-color: #C8E6C9;
font-size: 2em;
padding: 0 .5em;
}
</style>
<h3>Background</h3>
<p>IndexedDB Observers allow one to observe changes to indexeddb in an
efficient and data-consistant way. Open this page in multiple tabs or windows,
and observe how the data consistantly updates. See <a href="https://github.com/WICG/indexed-db-observers/blob/gh-pages/EXPLAINER.md">this
explainer</a> for more info and the proposed specification changes.</a></p>
<p>Note that you must be using Chrome 57+ with the <code>#enable-experimental-web-platform-features</code> flag enabled.</p>
<h4>
Tab Name: <span id="name"></span>
Data number: <span id="data"></span>
</h4>
<button id="incrementButton">Increment Data Number</button>
<button id="resetButton">Reset Data Number</button>
{% capture initial_output_content %}
<pre>Database changes appear here:</pre>
{% endcapture %}
{% include output_helper.html initial_output_content=initial_output_content%}
{% include js_snippet.html filename='demo.js' %}
<script>
(function() {
var names = ['Toby', 'Fred', 'George', 'Bob', 'Bill', 'Buster',
'Jenn', 'Zoe', 'Carla', 'Stacy', 'Alyssa', 'Catherine',
'Sally', 'Austin', 'Jackson', 'Grace',
'Tasha', 'Arthur', 'Michael', 'Echo', 'Topher', 'Sierra',
'Whisky', 'DeWitt'];
document.querySelector('#name').textContent = names[Math.floor(
Math.random() * names.length)];
})();
document.querySelector('#incrementButton').addEventListener('click', function() {
onIncrementButtonClick();
});
document.querySelector('#resetButton').addEventListener('click', function() {
onResetButtonClick();
});
</script>