From 879a6dca783ccec04465cc621911f4ea7c1dcddb Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 28 Dec 2022 11:58:44 +0000 Subject: [PATCH 1/3] feat: debounce save function --- src/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 90ae628..7030d41 100644 --- a/src/index.js +++ b/src/index.js @@ -263,14 +263,18 @@ function addNewRules() { tempStyleList = []; } +let delayTimer; function save() { - if (linkTag && linkTag.hasAttribute('document_id') && linkTag.getAttribute('save') != 'false') { - const onlyUnique = (value, index, self) => { - return self.indexOf(value) === index; - }; - - let css = parsedCSS.concat(linkCSS).filter(onlyUnique); - crud.save(linkTag, css.join('\r\n')); + if (linkTag && linkTag.hasAttribute('document_id') && linkTag.getAttribute('save') != 'false') { + clearTimeout(delayTimer); + delayTimer = setTimeout(function() { + const onlyUnique = (value, index, self) => { + return self.indexOf(value) === index; + }; + + let css = parsedCSS.concat(linkCSS).filter(onlyUnique); + crud.save(linkTag, css.join('\r\n')); + }, 3000); } } From f223efd0c97386e7d5ed04d8ebea7f49b5661788 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 29 Dec 2022 09:27:56 +0000 Subject: [PATCH 2/3] fix: bump dependencies --- package.json | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1eddc3a..ee55d03 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,7 @@ "html5-framework", "javascript-framework" ], - "publishConfig": { - "access": "public" - }, + "publishConfig": { "access": "public" }, "scripts": { "start": "npx webpack --config webpack.config.js", "build": "NODE_ENV=production npx webpack --config webpack.config.js", @@ -60,9 +58,9 @@ "webpack-log": "^3.0.1" }, "dependencies": { - "@cocreate/crud-client": "^1.17.3", - "@cocreate/docs": "^1.4.26", - "@cocreate/hosting": "^1.6.27", - "@cocreate/observer": "^1.5.48" + "@cocreate/crud-client": "^1.17.5", + "@cocreate/docs": "^1.4.27", + "@cocreate/hosting": "^1.6.28", + "@cocreate/observer": "^1.5.49" } } From f342609cd74ac2da379ddf0fd10cebca9b1f63f1 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 29 Dec 2022 09:32:38 +0000 Subject: [PATCH 3/3] chore(release): 1.4.0 [skip ci] # [1.4.0](https://github.com/CoCreate-app/CoCreate-css-parser/compare/v1.3.9...v1.4.0) (2022-12-29) ### Bug Fixes * bump dependencies ([f223efd](https://github.com/CoCreate-app/CoCreate-css-parser/commit/f223efd0c97386e7d5ed04d8ebea7f49b5661788)) ### Features * debounce save function ([879a6dc](https://github.com/CoCreate-app/CoCreate-css-parser/commit/879a6dca783ccec04465cc621911f4ea7c1dcddb)) --- CHANGELOG.md | 12 ++++++++++++ package.json | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc0c7ea..50ba8e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# [1.4.0](https://github.com/CoCreate-app/CoCreate-css-parser/compare/v1.3.9...v1.4.0) (2022-12-29) + + +### Bug Fixes + +* bump dependencies ([f223efd](https://github.com/CoCreate-app/CoCreate-css-parser/commit/f223efd0c97386e7d5ed04d8ebea7f49b5661788)) + + +### Features + +* debounce save function ([879a6dc](https://github.com/CoCreate-app/CoCreate-css-parser/commit/879a6dca783ccec04465cc621911f4ea7c1dcddb)) + ## [1.3.9](https://github.com/CoCreate-app/CoCreate-css-parser/compare/v1.3.8...v1.3.9) (2022-12-27) diff --git a/package.json b/package.json index ee55d03..9970ba1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cocreate/css-parser", - "version": "1.3.9", + "version": "1.4.0", "description": "A simple css-parser component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.", "keywords": [ "css-parser", @@ -20,7 +20,9 @@ "html5-framework", "javascript-framework" ], - "publishConfig": { "access": "public" }, + "publishConfig": { + "access": "public" + }, "scripts": { "start": "npx webpack --config webpack.config.js", "build": "NODE_ENV=production npx webpack --config webpack.config.js",