97 lines
2.7 KiB
HTML
Executable File
97 lines
2.7 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: Source: lib/sys.js</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="main">
|
|
|
|
<h1 class="page-title">Source: lib/sys.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>/**
|
|
* # Carga Inicial
|
|
*
|
|
* Esta funcion permite determinar el estado de los datos en memoria, cargandolos desde el servidor en caso de que no exista o comprobando si se encuentran modificados en relacion con el archivo original
|
|
*
|
|
* Esta funcion devuelve un array que contiene los datos de la entrada
|
|
*/
|
|
export async function carga() {
|
|
var respuesta
|
|
var texto
|
|
if (localStorage.getItem("entradas") == undefined) {//no hay nada guardado
|
|
//agregar try and catch
|
|
respuesta = await fetch("entradas.json")
|
|
texto = await respuesta.text()
|
|
localStorage.setItem("entradas", texto)
|
|
return JSON.parse(texto)
|
|
} else {
|
|
return JSON.parse(localStorage.getItem("entradas"))
|
|
}
|
|
}
|
|
|
|
export async function recarga(){
|
|
var respuesta
|
|
var texto
|
|
respuesta = await fetch("entradas.json")
|
|
texto = await respuesta.text()
|
|
localStorage.setItem("entradas", texto)
|
|
}
|
|
|
|
/**
|
|
* # Actualizar
|
|
*
|
|
* Actualiza el valor almacenado en el localstorage
|
|
*
|
|
* @param {*} entradas El objeto completo de las entradas para combinar con el localstorage
|
|
*/
|
|
export function actualizar(entradas){
|
|
localStorage.setItem("entradas",JSON.stringify(entradas))
|
|
return "exito"
|
|
}
|
|
|
|
export function datetime(){
|
|
var datetime = new Date()
|
|
return datetime.getFullYear()+"-"+datetime.getMonth()+"-"+datetime.getDate()+" "+datetime.getHours()+":"+datetime.getMinutes()+":"+datetime.getSeconds()
|
|
|
|
}</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#actualizar">actualizar</a></li><li><a href="global.html#carga">carga</a></li><li><a href="global.html#init">init</a></li></ul>
|
|
</nav>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Thu Sep 23 2021 11:30:56 GMT-0500 (GMT-05:00)
|
|
</footer>
|
|
|
|
<script> prettyPrint(); </script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html>
|