• Thank you, that worked really well! 🙂

    In case anybody else is looking for it, here is what I did:

    • Download UMD file for the npm module in question. E.g. https://cdn.jsdelivr.net/npm/discrete-wa­velets@5/dist/discrete-wavelets.umd.js
    • (I learnt: UMD = Universal Module Definition, patterns for JavaScript modules that work everywhere.)
    • For testing, store this file in Flash on the watch in Device Storage, using the Web IDE.
    • In Web IDE, create a sample code file to the right, referencing this module file and using its functionality. Run that.

    Example for the above module:

    // Upload discrete-wavelets.umd.js to Bangle local storage
    Number.isInteger = it => isFinite(it) && Math.floor(it) === it; // To replace missing Number class in Espruino
    var wt = require("discrete-wavelets.umd.js"); // load from local storage
    var coeffs = wt.dwt([1, 2, 3, 4], 'haar');
    console.log(coeffs);
    // expected output: Array [[2.1213203435596425, 4.9497474683058326], [-0.7071067811865475, -0.7071067811865475]]
    

    When using the library with a real-world sample of 250 values (not just [1,2,3,4]), I seem to get a timeout problem ("Prompt not detected - upload failed"). But I look into solving this using the advice from https://forum.espruino.com/conversations­/289212/ .

About

Avatar for user157902 @user157902 started