Adding Morse code to any web application should be fun and easy. CW.js is a Javascript library that allows developers to embed Morse code widgets into their existing websites and applications.
First, add the CW.js script to your website by linking it to our CDN:
<script src="https://cdn.jsdelivr.net/npm/cw@latest/dist/cw.min.js"></script>
Now, you can call the Morse code function anywhere in your code:
cw.play("Hello world");
The tone frequency and speed are customizable by passing an options object:
cw.play("Hello world", {
tone: 700, // tone frequency in Hz
wpm: 20, // speed in words per minute
fwpm: 10, // farnsworth speed in words per minute
});
CW.js is also available for installation via NPM:
$ npm install cw
It can then be imported into any Node module:
const cw = require('cw');
Developers wishing to work on the library can clone the repository and run their own builds:
$ git clone https://github.com/mastercw/cw.js.git
$ npm install
$ npm run build
CW.js is an open-source library, let us know if you have any issues, comments or requests by opening an issue on Github!