Skip to content

Commit 99a5d04

Browse files
committed
added a new parameter for audio method, with that parameter, no need to re-encode if Morse string is already present.
1 parent 18d4265 commit 99a5d04

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

dist/morsify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
524524
var AudioContext = null;
525525
var context = null;
526526

527-
var audio = function audio(text, opts) {
527+
var audio = function audio(text, opts, morseString) {
528528
if (AudioContext === null && typeof window !== 'undefined') {
529529
AudioContext = window.AudioContext || window.webkitAudioContext;
530530
context = new AudioContext();
531531
}
532532

533533
var options = getOptions(opts);
534-
var morse = encode(text, opts);
534+
var morse = morseString || encode(text, opts);
535535
var oscillator = context.createOscillator();
536536
var gainNode = context.createGain();
537537
var timeout;

dist/morsify.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "morsify",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "Morse code translator, Morse encoder and decoder which can also generate audio.",
55
"keywords": [
66
"morsify",

src/morsify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@
180180
let AudioContext = null;
181181
let context = null;
182182

183-
const audio = (text, opts) => {
183+
const audio = (text, opts, morseString) => {
184184

185185
if (AudioContext === null && typeof window !== 'undefined') {
186186
AudioContext = window.AudioContext || window.webkitAudioContext;
187187
context = new AudioContext();
188188
}
189189

190190
const options = getOptions(opts);
191-
const morse = encode(text, opts);
191+
const morse = morseString || encode(text, opts);
192192
const oscillator = context.createOscillator();
193193
const gainNode = context.createGain();
194194

0 commit comments

Comments
 (0)