UNPKG

soundtouch-api

Version:
17 lines (15 loc) 458 B
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 } }