IndexedDB native


## Create
```typelet dbconnect = window.indexedDB.open('cache', 1)let dbdbconnect.onupgradeneeded = ev => {  console.log('Upgrade DB');  const db = ev.target.result;  const store = db.createObjectStore('LasJson', { keyPath: 'id', autoIncrement: true });  store.createIndex('name', 'name', { unique: false });  store.createIndex('data', 'data', { unique: true });}dbconnect.onsuccess = ev => {  console.log('DB-Upgrade needed')  db = ev.target.result  const transaction = db.transaction('LasJson', 'readwrite')  const store = transaction.objectStore('LasJson')  const data = [    {name: 'Raptor123', data: {}},    {name: 'Dino2', data: {}}  ]  data.forEach(el => store.add(el));  transaction.onerror = ev => {    console.error('An error has occured!', ev.target.error.message);  }}```


## Access by index
```typevar transaction = db.transaction(["LasJson"]);var objectStore = transaction.objectStore("LasJson");var request = objectStore.get(1);request.onerror = function(event) {  console.log("Request failed!");}request.onsuccess = function(event) {  if (request.result) {    console.log(request.result.name);    console.log(request.result.data);  } else {    console.log("No more entries!");  }};```

[IndexedDB cursor](https://texonom.com/indexeddb-cursor-11a9aeb403d940fda70712d352faf54f)


### get by index
```typevar transaction = db.transaction(["LasJson"])var objectStore = transaction.objectStore("LasJson")var index = objectStore.index("name")index.get("Raptor123").onsuccess = function(event) {  console.log(event.target.result.data)}```

### Set data
```typevar transaction = db.transaction(["LasJson"], "readwrite")var objectStore = transaction.objectStore("LasJson")var request = objectStore.add({name: 'asda', data: {}})```

[IndexedDB onupgradeneeded](https://texonom.com/indexeddb-onupgradeneeded-3e09436c3a114e21b97fad642f5fbe65)
