[Pkg-javascript-commits] [pdf.js] 119/174: Make the view history cache size configurable during initialization
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:45:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 55870788e5585df6a26e0b019420a99173e86ef8
Author: Tim van der Meij <timvandermeij at gmail.com>
Date: Mon Nov 2 14:56:50 2015 +0100
Make the view history cache size configurable during initialization
---
web/view_history.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/web/view_history.js b/web/view_history.js
index d4f65f2..a054821 100644
--- a/web/view_history.js
+++ b/web/view_history.js
@@ -18,7 +18,7 @@
'use strict';
-var VIEW_HISTORY_MEMORY = 20;
+var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
/**
* View History - This is a utility for saving various view parameters for
@@ -30,8 +30,9 @@ var VIEW_HISTORY_MEMORY = 20;
* - GENERIC or CHROME - uses localStorage, if it is available.
*/
var ViewHistory = (function ViewHistoryClosure() {
- function ViewHistory(fingerprint) {
+ function ViewHistory(fingerprint, cacheSize) {
this.fingerprint = fingerprint;
+ this.cacheSize = cacheSize || DEFAULT_VIEW_HISTORY_CACHE_SIZE;
this.isInitializedPromiseResolved = false;
this.initializedPromise =
this._readFromStorage().then(function (databaseStr) {
@@ -41,7 +42,7 @@ var ViewHistory = (function ViewHistoryClosure() {
if (!('files' in database)) {
database.files = [];
}
- if (database.files.length >= VIEW_HISTORY_MEMORY) {
+ if (database.files.length >= this.cacheSize) {
database.files.shift();
}
var index;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list