@internetarchive/ia-book-actions 0.0.29-alpha12 → 0.0.29-alpha13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/demo/index.html CHANGED
@@ -129,8 +129,8 @@
129
129
  iaBookActions.returnUrl = 'https://openlibrary.org';
130
130
  iaBookActions.localCache = localCache;
131
131
  iaBookActions.loanRenewConfig = {
132
- totalTime: 60, // 60 second = 1 min
133
- autoCheckAt: 55, // totalTime - 10th minute
132
+ totalTime: 10, // 60 second = 1 min
133
+ autoCheckAt: 5, // totalTime - 10th minute
134
134
  pageChangedInLast: 15, // within last 15 second/minute
135
135
  };
136
136
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.0.29-alpha12",
3
+ "version": "0.0.29-alpha13",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -114,7 +114,17 @@ export default class IABookActions extends LitElement {
114
114
 
115
115
  bindLoanRenewEvents() {
116
116
  // dispatched this event from bookreader page changed
117
+ window.addEventListener(`BookReader:pageChanged`, () => {
118
+ console.log('window addEventListener!')
119
+ // early return if book is not browsed (1 hour borrow)
120
+ if (this.borrowType !== 'browsed') return nothing;
121
+
122
+ this.isPageChanged = true;
123
+ this.executeLoanRenew();
124
+ })
125
+
117
126
  this.addEventListener('BookReader:pageChanged', e => {
127
+ console.log('this addEventListener!')
118
128
 
119
129
  // early return if book is not browsed (1 hour borrow)
120
130
  if (this.borrowType !== 'browsed') return nothing;
@@ -159,6 +169,7 @@ export default class IABookActions extends LitElement {
159
169
 
160
170
  // show message after browsed book is expired.
161
171
  this.loanRenewResult.texts = 'This book has been auto-returned due to inactivity.';
172
+ this.update();
162
173
  }
163
174
 
164
175
  async browseHasRenew() {