GithubHelp home page GithubHelp logo

Comments (10)

pierremtb avatar pierremtb commented on May 29, 2024

Hi!
I think that it is technically possible. Though I tried to make it work with the FileReader api, but I failed, and I didn't have much time to investigate.
It would be an awesome feature.

from easy-fit.

corand avatar corand commented on May 29, 2024

Thanks, I will also have a look at it.
Nice job!

from easy-fit.

brvier avatar brvier commented on May 29, 2024

I made it
brvier/ForRunners@b323bf7
But readAsArrayBuffer return an array buffer so i changed getArrayBuffer(buffer) in binary.js to return buffer ... ;p

But some changes was required .... first using browserify :
$ browserify easy-fit.js --standalone easy-fit > easy-fit.bundle.js

from easy-fit.

corand avatar corand commented on May 29, 2024

Looking good!

from easy-fit.

corand avatar corand commented on May 29, 2024

Here is a working example of the simplified version of @khertan

`

<title>Easy FIT</title>

</head>

<body>

    <input type="file" id="fileUpload">


    <script type="text/javascript" src="easy-fit.bundle.js"></script>

    <script>

        var fileUpload = document.getElementById("fileUpload");

        fileUpload.addEventListener("change", function(event) {
            var file = this.files[0];
                var EasyFit = window.easyFit.default;

                var reader = new FileReader();

                reader.onloadend = function() {

                    // Create a EasyFit instance (options argument is optional)
                    var easyFit = new EasyFit({
                        force: true,
                        speedUnit: 'km/h',
                        lengthUnit: 'km',
                        temperatureUnit: 'celcius',
                        elapsedRecordField: true,
                        mode: 'cascade',
                    });

                    easyFit.parse(this.result, function (error, data) {
                        if (error) {
                            console.log(error);
                        } else {
                            console.log(data);
                        }
                    });
                };

                reader.readAsArrayBuffer(file);
        }, false);

    })();

</script>
</body>
`

from easy-fit.

pierremtb avatar pierremtb commented on May 29, 2024

@khertan @corand Awesome! Thanks for your investigation :)

from easy-fit.

gfmoore avatar gfmoore commented on May 29, 2024

Hi, late to the show I guess,

I had a look at this, but browserify doesn't work with ES6 module import and export. I understand that I could transpile it to ES5 with babel (though I don't know how to do that). Just wondering if there was any other solution?

I suppose I could manually copy and paste the modules into the main js file, but that seems a bit counter-productive. (Though I'll probably have a go for now.)

Gordon

from easy-fit.

pierremtb avatar pierremtb commented on May 29, 2024

Hi @gfmoore, thanks for the interest!
I’ll try my best to answer this but it’s been a while (we will have a TypeScript version coming up some day with @jimmykane). What stack are you using on the front end?

from easy-fit.

gfmoore avatar gfmoore commented on May 29, 2024

Hey, thanks for the response. Don't worry about it as now I've simply grabbed all four js files, removed imports, exports, wrote a function to replace the Buffer usage (only the one that makes a string from the array of int (bytes) and it works client side. Not perhaps elegant, not perhaps very modular, but it's a hack and allows me to do what I want. I posted the code in a comment on the backfit site backfit/backfit#6

It's a hack! (I'm just using JS, jQuery, jStat and D3 for developing some personal apps (cycling, Karoo v1) and just wanted to grab my data quickly. For some strange reason the Karoo dashboard does not do anything with the data it grabs, but does allow download of data in a FIT file. I'm not paying Strava for the analysis...

Ta.

from easy-fit.

pierremtb avatar pierremtb commented on May 29, 2024

@gfmoore Cool! Glad this way works for you. Never had to transpile stuff outside of pipelines like Grunt which make it easy.

from easy-fit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.