Giter VIP home page Giter VIP logo

get-flow's People

Contributors

enricostara avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

qloudio

get-flow's Issues

Problems with browserify

I'm using telegram.link library in the browser and I've found some problems of get-flow with browserify. I'm not sure if it's of browserify itself or of the babelify module, but I've found that in several places the callback argument is converted to _callback to prevent collision of names. One of the cases is the requestPQ function from telegram-mt-node module, that gets converted from

// Request a PQ pair number
function requestPQ(_callback, channel) {
    // Create a nonce for the client
    var clientNonce = utility.createNonce(16);
    mtproto.service.req_pq({
        props: {
            nonce: clientNonce
        },
        channel: channel,
        callback: function callback(ex, resPQ) {
            if (clientNonce === resPQ.nonce) {
                var context = {
                    resPQ: resPQ,
                    channel: channel
                };
                _callback(null, context);
            } else {
                _callback(createError('Nonce mismatch.', 'ENONCE'));
            }
        }
    });
}

to

// Request a PQ pair number
function requestPQ(callback, channel) {
    // Create a nonce for the client
    var clientNonce = utility.createNonce(16);
    mtproto.service.req_pq({
        props: {
            nonce: clientNonce
        },
        channel: channel,
        callback: function (ex, resPQ) {
            if (clientNonce === resPQ.nonce) {
                var context = {
                    resPQ: resPQ,
                    channel: channel
                };
                callback(null, context);
            } else {
                callback(createError('Nonce mismatch.', 'ENONCE'));
            }
        }
    });
}

As you can see, the callback name was also removed, converting the inner function in an annonimous one. Do you know what could be happening and how to fix it? And as a side note, why are you using the function names instead of detect if the last argument it's a function the same way as it's usually done on Node.js libraries?

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.