Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emoji-picker-element

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emoji-picker-element - npm Package Compare versions

Comparing version 1.8.0 to 1.8.1

14

CHANGELOG.md

@@ -0,1 +1,15 @@

## [1.8.1](https://github.com/nolanlawson/emoji-picker-element/compare/v1.8.0...v1.8.1) (2021-09-03)
### Bug Fixes
* respect the hidden attribute ([#221](https://github.com/nolanlawson/emoji-picker-element/issues/221)) ([b3a5138](https://github.com/nolanlawson/emoji-picker-element/commit/b3a51381194af1f9ec6031a0afb1af39b4444a6f))
### Performance Improvements
* use relaxed IDB transactions and manually commit ([#218](https://github.com/nolanlawson/emoji-picker-element/issues/218)) ([d732610](https://github.com/nolanlawson/emoji-picker-element/commit/d732610e7fede78df4e9bbc6ce964690d2fe4adf))
# [1.8.0](https://github.com/nolanlawson/emoji-picker-element/compare/v1.7.1...v1.8.0) (2021-08-18)

@@ -2,0 +16,0 @@

54

database.js

@@ -125,14 +125,16 @@ function assertNonEmptyString (str) {

return new Promise((resolve, reject) => {
const tx = db.transaction(storeName, readOnlyOrReadWrite);
// Use relaxed durability because neither the emoji data nor the favorites/preferred skin tone
// are really irreplaceable data. IndexedDB is just a cache in this case.
const txn = db.transaction(storeName, readOnlyOrReadWrite, { durability: 'relaxed' });
const store = typeof storeName === 'string'
? tx.objectStore(storeName)
: storeName.map(name => tx.objectStore(name));
? txn.objectStore(storeName)
: storeName.map(name => txn.objectStore(name));
let res;
cb(store, (result) => {
cb(store, txn, (result) => {
res = result;
});
tx.oncomplete = () => resolve(res);
txn.oncomplete = () => resolve(res);
/* istanbul ignore next */
tx.onerror = () => reject(tx.error);
txn.onerror = () => reject(txn.error);
})

@@ -279,2 +281,9 @@ }

function commit (txn) {
/* istanbul ignore else */
if (txn.commit) {
txn.commit();
}
}
// like lodash's minBy

@@ -332,3 +341,3 @@ function minBy (array, func) {

const BATCH_SIZE = 50; // Typically around 150ms for 6x slowdown in Chrome for above benchmark
return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, cb) => {
return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, txn, cb) => {
let lastKey;

@@ -358,3 +367,3 @@

const transformedData = transformEmojiData(emojiData);
await dbPromise(db, [STORE_EMOJI, STORE_KEYVALUE], MODE_READWRITE, ([emojiStore, metaStore]) => {
await dbPromise(db, [STORE_EMOJI, STORE_KEYVALUE], MODE_READWRITE, ([emojiStore, metaStore], txn) => {
let oldETag;

@@ -383,2 +392,3 @@ let oldUrl;

metaStore.put(url, KEY_URL);
commit(txn);
}

@@ -401,3 +411,3 @@

async function getEmojiByGroup (db, group) {
return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, cb) => {
return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, txn, cb) => {
const range = IDBKeyRange.bound([group, 0], [group + 1, 0], false, true);

@@ -415,3 +425,3 @@ getAllIDB(emojiStore.index(INDEX_GROUP_AND_ORDER), range, cb);

return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, cb) => {
return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, txn, cb) => {
// get all results that contain all tokens (i.e. an AND query)

@@ -466,3 +476,3 @@ const intermediateResults = [];

async function getEmojiByUnicode (db, unicode) {
return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, cb) => (
return dbPromise(db, STORE_EMOJI, MODE_READONLY, (emojiStore, txn, cb) => (
getIDB(emojiStore, unicode, result => {

@@ -478,3 +488,3 @@ if (result) {

function get (db, storeName, key) {
return dbPromise(db, storeName, MODE_READONLY, (store, cb) => (
return dbPromise(db, storeName, MODE_READONLY, (store, txn, cb) => (
getIDB(store, key, cb)

@@ -485,13 +495,15 @@ ))

function set (db, storeName, key, value) {
return dbPromise(db, storeName, MODE_READWRITE, (store) => (
store.put(value, key)
))
return dbPromise(db, storeName, MODE_READWRITE, (store, txn) => {
store.put(value, key);
commit(txn);
})
}
function incrementFavoriteEmojiCount (db, unicode) {
return dbPromise(db, STORE_FAVORITES, MODE_READWRITE, (store) => {
getIDB(store, unicode, result => (
store.put((result || 0) + 1, unicode)
));
})
return dbPromise(db, STORE_FAVORITES, MODE_READWRITE, (store, txn) => (
getIDB(store, unicode, result => {
store.put((result || 0) + 1, unicode);
commit(txn);
})
))
}

@@ -503,3 +515,3 @@

}
return dbPromise(db, [STORE_FAVORITES, STORE_EMOJI], MODE_READONLY, ([favoritesStore, emojiStore], cb) => {
return dbPromise(db, [STORE_FAVORITES, STORE_EMOJI], MODE_READONLY, ([favoritesStore, emojiStore], txn, cb) => {
const results = [];

@@ -506,0 +518,0 @@ favoritesStore.index(INDEX_COUNT).openCursor(undefined, 'prev').onsuccess = e => {

{
"name": "emoji-picker-element",
"version": "1.8.0",
"version": "1.8.1",
"description": "Lightweight emoji picker distributed as a web component",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc