I have done a BBCode editor in JavaScript but I need that those values entered (in principle only a value that is the name of a fruit) are stored in a NoSQL database with using IndexedDB and LocalStorage, the problem is that I am quite lost in the subject and I do not know where to start, I'm going to put what I have here and see if you are going to tell me because the subject seems complicated ...
FRUTA.namespace('FRUTA.IndexeDB');
(function(g){
'use strict';
FRUTA.IndexeDB.localDatabase = {};
FRUTA.IndexeDB.inicializa = function(){
FRUTA.IndexeDB.localDatabase.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
FRUTA.IndexeDB.localDatabase.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
FRUTA.IndexeDB.localDatabase.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction;
FRUTA.IndexeDB.localDatabase.indexedDB.onerror = function (e) {
console.log("Database error: " + e.target.errorCode);
};
};
FRUTA.IndexeDB.openDB = function(dbName, version){
var openRequest = FRUTA.IndexeDB.localDatabase.indexedDB.open(dbName,version);
openRequest.onerror = function(e) {
console.log("Database open error: " + e.target.errorCode);
};
openRequest.onsuccess = function(event) {
FRUTA.IndexeDB.localDatabase.db = openRequest.result;
};
};
})(window);