KindleCalendar icon indicating copy to clipboard operation
KindleCalendar copied to clipboard

chore: Update npm dependencies and fix WebSocket import in server.js

Open LightYagami28 opened this issue 1 year ago • 0 comments

Description

This pull request includes several updates to improve the codebase of the KindleCalendar project. The changes encompass enhancements to JavaScript syntax, Python script organization, and server-side JavaScript code clarity.

Changes

client.js:

  • Updated JavaScript syntax to use arrow functions, let and const instead of var, and template literals for string interpolation.
  • Improved event handling by using addEventListener instead of assigning event handlers directly to properties like onclick.
  • Enhanced error handling and readability.

screenshot.py:

  • Grouped imported modules together at the top of the script.
  • Followed PEP8 naming conventions for variables and function names.
  • Improved code comments for better readability and understanding.
  • Used f-strings for string formatting.
  • Utilized a dictionary for mapping day names to offsets.
  • Removed unnecessary imports and commented-out code.
  • Updated code formatting to be consistent.

server.js:

  • Changed the import statement for WebSocket from require('ws-plus-hixie') to require('ws').
  • Renamed the WsHixie variable to WebSocket for clarity.
  • Used let and const instead of var.
  • Updated the watcher.on('change') callback function to use let instead of var for the now variable.
  • Applied consistent semicolon usage.
  • Improved readability by adding comments to clarify code blocks.

These changes aim to enhance the maintainability, readability, and efficiency of the KindleCalendar project.

Checklist

  • [x] Updated JavaScript syntax in client.js
  • [x] Organized Python imports and followed PEP8 conventions in screenshot.py
  • [x] Refactored server.js for clarity and consistency
  • [x] Checked and tested the functionality of the updated code
  • [x] Updated the documentation and included a changelog

LightYagami28 avatar May 03 '24 09:05 LightYagami28