<commit_before>import loadVt from "./../vt-js/Cargo.toml";
import {asciicast} from "./driver/asciicast";
import {test} from "./driver/test";
import {websocket} from "./driver/websocket";
const vt = loadVt(); // trigger async loading of wasm


class AsciinemaPlayerCore {
  // public

  constructor(src, opts, onFinish) {
    let feed = this.feed.bind(this);

    if (src.driver == 'asciicast') {
      this.driver = asciicast(src.url, null, null, 1, feed, onFinish);<commit_msg>Support passing driver function as src<commit_after>import loadVt from "./../vt-js/Cargo.toml";
import {asciicast} from "./driver/asciicast";
import {test} from "./driver/test";
import {websocket} from "./driver/websocket";
const vt = loadVt(); // trigger async loading of wasm


class AsciinemaPlayerCore {
  // public

  constructor(src, opts, onFinish) {
    let feed = this.feed.bind(this);

    if (typeof src == 'function') {
      this.driver = src({ feed, onFinish });
    } else if (src.driver == 'asciicast') {
      this.driver = asciicast(src.url, null, null, 1, feed, onFinish);
{'fraction_non_alphanumeric': 0.15902712815715622, 'fraction_numerical': 0.0018709073900841909, 'mean_word_length': 3.6724890829694323, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3651647', 'n_tokens_mistral': 367, 'n_tokens_neox': 355, 'n_words': 99}