Skip to content

Commit 34714fc

Browse files
authored
Update to ecmascript 6 arrow functions
1 parent 0863fde commit 34714fc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The test files provide up to date example of the use of the api.
9898
`SQL.Database` constructor takes an array of integer representing a database file as an optional parameter.
9999
The following code uses an HTML input as the source for loading a database:
100100
```javascript
101-
dbFileElm.onchange = function() {
101+
dbFileElm.onchange = () => {
102102
var f = dbFileElm.files[0];
103103
var r = new FileReader();
104104
r.onload = function() {
@@ -117,7 +117,7 @@ var xhr = new XMLHttpRequest();
117117
xhr.open('GET', '/path/to/database.sqlite', true);
118118
xhr.responseType = 'arraybuffer';
119119

120-
xhr.onload = function(e) {
120+
xhr.onload = e => {
121121
var uInt8Array = new Uint8Array(this.response);
122122
var db = new SQL.Database(uInt8Array);
123123
var contents = db.exec("SELECT * FROM my_table");
@@ -165,9 +165,9 @@ Example:
165165
```html
166166
<script>
167167
var worker = new Worker("js/worker.sql.js"); // You can find worker.sql.js in this repo
168-
worker.onmessage = function() {
168+
worker.onmessage = () => {
169169
console.log("Database opened");
170-
worker.onmessage = function(event){
170+
worker.onmessage = event => {
171171
console.log(event.data); // The result of the query
172172
};
173173
@@ -178,7 +178,7 @@ Example:
178178
});
179179
};
180180
181-
worker.onerror = function(e) {console.log("Worker error: ", e)};
181+
worker.onerror = e => console.log("Worker error: ", e);
182182
worker.postMessage({
183183
id:1,
184184
action:'open',

0 commit comments

Comments
 (0)