[email protected]
Twitter
LinkedIn
Youtube
GitHub
  • Services
  • Blog
  • Dépôts
  • GitHub
  • CV
  • Contact
Produit a été ajouté à votre panier

Chariot

Dexie.js: Une bibliothèque simple et robuste pour indexedDB (HTML5 Storage)

Juillet 16, 2015L'extrémité avantjfadev

Dexie.js est une bibliothèque simple et concise pour travailler avec les “Indexed Database API” ou IndexedDB.

IndexedDB est un moyen de stocker des données constamment dans le navigateur. Étant donné que permet la création d'applications web avec les fonctionnalités de requête améliorés, celles-ci peuvent être exécutés en ligne et hors ligne. IndexedDB est utile pour les applications qui stockent une grande quantité de données et les applications ne nécessitant pas une connexion permanente à Internet pour travailler.

Il peut aussi être très utile pour enregistrer des données au niveau local dans une application hybride par exemple.

Exemple d'utilisation:

/*
|---------------------------------------------
| 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

Documentation: GitHub

Dépôt

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

Services

  • Excel2chatGPT $10.00
  • Bot Tok $45.00 $40.00
  • Correction de bogues dans votre application PHP Symfony $70.00 / heure
  • Correction de bogues de votre site Wordpress $70.00 / heure
  • Automatisation des tâches à l'aide de Node.js $70.00 / heure

Blog

  • Comment payer avec une carte bancaire sur Cryptomus
  • Guide complet du débutant sur le tok bot: Commandes de terminal expliquées
  • Meilleur site pour gagner des vues sur TikTok
  • Chatbot Jfa Whatsapp
  • Bot pour TikTok

Explorer

  • Gratuit 10 J’aime Tiktok
  • Vues TikTok 2K gratuites
  • Gratuit 100 Favoris TikTok
  • Gratuit 300 Partages TikTok
  • Acheter des vues TikTok
  • Gratuit 100 J'aime Instagram
Twitter
LinkedIn
Youtube
GitHub

© 2013-2025 Jordi Fernandes Alves (@jfadev)