soundtouch-api
Version:
SoundTouch API using TypeScript
17 lines (15 loc) • 458 B
text/typescript
import {XMLElement} from './utils';
export interface Time {
readonly current: number;
readonly total: number;
}
export function timeFromElement(element: XMLElement): Time {
const totalString = element.getAttribute('total');
const currentString = element.getText();
const total = totalString ? parseInt(totalString) : 0;
const current = currentString ? parseInt(currentString) : 0;
return {
current,
total
}
}