[email protected]
Twitter
LinkedIn
YouTube
GitHub
  • Servicios
  • Blog
  • Repositorios
  • GitHub
  • Currículum
  • Contacto
Producto se añadió a tu carrito

Carrito

Dexie.js: Una libreria simple y robusta para indexedDB (HTML5 Storage)

julio 16, 2015Front-Endjfadev

Dexie.js es una librería sencilla y concisa para trabajar con la “Indexed Database API” o IndexedDB.

IndexedDB es una manera de almacenar datos de manera persistente en el navegador. Dado que permite la creación de aplicaciones web con capacidades de consulta mejoradas, éstas pueden funcionar tanto en línea como fuera de línea. IndexedDB es útil para aplicaciones que almacenan una gran cantidad de datos y para aplicaciones que no necesitan de una conexión permanente a Internet para funcionar.

También puede ser muy útil para guardar datos en local en una app híbrida por ejemplo.

Ejemplo de uso:

/*
|---------------------------------------------
| Make a database connection
|---------------------------------------------
*/

var db = new Dexie('MyDatabase');

// Define a schema
db.version(1)
    .stores({
        friends: 'name, age'
    });

// Open the database
db.open()
    .catch(function(error){
        alert('Uh oh : ' + error);
    });


/*
|---------------------------------------------
| Then run some queries
|---------------------------------------------
*/

// Find some old friends
db.friends
    .where('age')
    .above(75)
    .each(function(friend){
        console.log(friend.name);
    });

// or make a new one
db.friends
    .add({
        name: 'Camilla',
        age: 25
    });

Web: dexie.org

Documentacion: GitHub

Repository

A Minimalistic Wrapper for IndexedDB
https://github.com/dexie/Dexie.js
694 forks.
14,110 stars.
588 open issues.

Recent commits:
  • fix(dexie-export-import): fix UTF-8 corruption for non-ASCII strings during import (#2259)* fix(dexie-export-import): fix UTF-8 corruption for non-ASCII strings during import (#2105)The streaming import reads a Blob in fixed-size byte chunks. When a chunkboundary falls inside a multi-byte UTF-8 sequence (e.g. Chinese/Japanesecharacters that occupy 3 bytes each), the partial byte sequence was decodedas a replacement character (U+FFFD / ��) instead of the correct character.Fix: switch from reading each slice as text (readBlobAsync/Sync with 'text')to reading it as an ArrayBuffer ('binary') and decoding with a TextDecoderin streaming mode ({ stream: true }). The TextDecoder buffers incompletemulti-byte sequences between chunks and emits them correctly once theremaining bytes arrive in the next chunk.Also add a regression test: 1000 records each containing 1000 repetitionsof the Chinese string '让我们说中文n' are exported and re-imported with a1 KB chunk size, then verified to contain no U+FFFD replacement characters.* fix: use fatal: true in TextDecoder to surface encoding errors loudly, GitHub
  • test(dexie-cloud): add unit tests for shouldOffloadBlob threshold behavior- Blob/File: always offloaded regardless of size (including 0-byte)- ArrayBuffer/TypedArray: threshold at 4096 bytes- Primitives/null/objects: never offloaded, David Fahlander
  • fix(dexie-cloud): always offload Blob/File objects regardless of size (#2182)Blob and File objects are now always offloaded to blob storage during sync,regardless of their size. Previously, only blobs >= 4KB were offloaded.This fixes #2182 where readBlobSync crashes in service workers becauseXMLHttpRequest is unavailable. By always offloading Blob/File objects,the data is never stored inline in IndexedDB, avoiding the need forsynchronous blob reading entirely.ArrayBuffer and TypedArray/DataView values retain the 4KB thresholdsince they don't have the same service worker limitation., David Fahlander
  • feat(dexie-cloud): Client-side blob offloading and lazy resolution- BlobRef format with _bt/_hasBlobRefs convention- Blob offloading: large binaries uploaded to blob storage, replaced with refs- Lazy blob resolution via blobResolveMiddleware- Eager blob downloader with parallel downloads (MAX_CONCURRENT=6)- Blob progress tracking (upload/download)- BlobSavingQueue for reliable blob persistence- TSON: transparent to BlobRefs (standard typedefs only)- get-object-diff: special-cases BlobRefs (same-ref = no diff)- Prepack hooks for workspace packages, GitHub
  • Use FinalizationRegistry for Dexie.connections and enforce maxConnections (#2254)* Refactor connection management to use FinalizationRegistry and maxConnectionsHistorically, Dexie tracked Dexie instances in a global 'connections'array to emulate 'versionchange' events and support BFCache. However,if developers forget to call close() on a Dexie instance, it remainsretained in this global array indefinitely, preventing garbage collection.This change replaces the global 'connections' array with a weaktracking mechanism using WeakRef and FinalizationRegistry. This allowsDexie instances that are no longer referenced by external code to beautomatically garbage collected, even if not explicitly closed.Chromium developers have observed an egregious number of connectionsaccumulating in real-world cases prior to this fix, leading tosignificant memory bloat in the browser process (hundreds of MiB).Additionally, this change introduces a 'maxConnections' limit(defaulting to 1000) to prevent unbounded growth of the number ofconnections if code unknowingly keeps references to a large numberof instances. db.open() will now throw a MaxConnectionsReachedErrorif this limit is exceeded.These changes significantly improve the memory efficiency of Dexieby default while maintaining backward compatibility and providingrobustness against connection leaks.* Replace the ConnectionTracker class and global connections array with asimpler WeakRef-based module (src/globals/connections.ts). Connections arenow tracked via a Set<WeakRef<Dexie>> with a FinalizationRegistry forautomatic cleanup when Dexie instances are garbage collected.Key changes:- Move maxConnections from a static property (Dexie.maxConnections) to a per-instance option in DexieOptions, defaulting to 1000- Replace ConnectionTracker class with smaller connection collection- Remove MaxConnectionsReached error — when the limit is exceeded, the oldest connection is evicted instead of throwing- Expose Dexie.connections as a getter that returns a snapshot array- Delete src/helpers/connection-tracker.ts* Fix coderabbit lack of undefined check* Remove unused Dexie import* Update connection handling to use db._novip———Co-authored-by: François Doray <[email protected]>Co-authored-by: David Fahlander <[email protected]>, GitHub

: Database, HTML5, IndexedDB, JS, Library, Storage, Web Developement

Servicios

  • Excel2chatGPT $10.00
  • Bot Tok $45.00 $40.00
  • Corrección de errores en tu aplicación PHP Symfony $70.00 / hora
  • Corrección de errores Wordpressen su sitio de $70.00 / hora
  • Automatización de tareas usando Node.js $70.00 / hora

Blog

  • Cómo pagar con una tarjeta bancaria en Cryptomus
  • Guía completa para principiantes de Bot Tok: Comandos de terminal explicados
  • Mejor sitio para obtener vistas en TikTok
  • Jfa Whatsapp chatbot
  • TikTok Bot

Explorar

  • Gratis 10 Me gusta
  • Vistas gratuitas de 2K TikTok
  • Gratis 100 Favoritos de Tik Tok
  • Gratis 300 Acciones de TikTok
  • Comprar vistas de TikTok
  • Gratis 100 Me gusta en Instagram
Twitter
LinkedIn
YouTube
GitHub

© 2013-2025 Jordi Fernandes Alves (@jfadev)