morse-player
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -6,2 +6,3 @@ import { TRenderResult } from './render'; | ||
index: number; | ||
charIndex: number; | ||
startPercent?: number; | ||
@@ -19,2 +20,3 @@ endPercent?: number; | ||
buffer: TRenderResult[]; | ||
charIndices: number[]; | ||
index: number; | ||
@@ -24,2 +26,3 @@ playTotal: number; | ||
constructor(input: string | TScriptPlay); | ||
_toCharIndices(buffer: TRenderResult[]): number[]; | ||
_getPlayTotal(): number; | ||
@@ -26,0 +29,0 @@ _getPlayCount(): number; |
@@ -12,2 +12,3 @@ import { render } from './render'; | ||
this.buffer = render(input); | ||
this.charIndices = this._toCharIndices(this.buffer); | ||
this.index = 0; | ||
@@ -17,2 +18,6 @@ this.playTotal = this._getPlayTotal(); | ||
} | ||
_toCharIndices(buffer) { | ||
let charIndex = 1; | ||
return buffer.map(entry => (typeof entry === 'string' ? charIndex++ : 0), []); | ||
} | ||
_getPlayTotal() { | ||
@@ -47,2 +52,3 @@ if (this.cbMethod) { | ||
index: this.index, | ||
charIndex: this.charIndices[this.index], | ||
startPercent: this.playTotal | ||
@@ -49,0 +55,0 @@ ? (this.playCount / this.playTotal) * 100 |
@@ -169,2 +169,3 @@ import { describe, expect, test } from '@jest/globals'; | ||
index: 1, | ||
charIndex: 0, | ||
name: "play", | ||
@@ -171,0 +172,0 @@ value: "b" |
{ | ||
"name": "morse-player", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Browser morse code audio player", | ||
@@ -24,2 +24,3 @@ "author": "Andrew Bunker", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@ham2k/lib-country-files": "^0.6.20231104", | ||
"@jest/globals": "^29.7.0", | ||
@@ -35,3 +36,2 @@ "@types/node": "20.1.7", | ||
}, | ||
"dependencies": {}, | ||
"scripts": { | ||
@@ -38,0 +38,0 @@ "test": "jest", |
Sorry, the diff of this file is not supported yet
240898
3541
13