This plugin adds a countdown timer onto the last price line of LWC. It requires LWC version 5.0.9 or greater.
Features:
- Customise the last price line (style, thickness, colour)
- Customise the last price label (background colour, text colour, price formatting)
- Customise the countdown timer (e.g. to display
1m 12s,01:12, etc)
npm install lwc-plugin-countdown-to-closeimport { CountdownToClose, CountdownToCloseOptions, TimeToClose } from 'lwc-plugin-countdown-to-close';Using the default countdown:
default-countdown.mov
npm install
npm run devVisit localhost:5173 in the browser.
npm run compileThis will:
- Compile TypeScript to JavaScript
- Bundle the plugin for both ES modules and UMD
- Generate TypeScript type definitions
- Output everything to the
dist/folder
You can configure the contents of the package's package.json within the
compile.mjs script.
Once you have compiled the plugin (see above section) then you can publish the package to NPM with these commands:
cd dist
npm publishHint: append --dry-run to the end of the publish command to see the results of
the publish command without actually uploading the package to NPM.