enricostara / get-flow Goto Github PK
View Code? Open in Web Editor NEWNode.js Flow Control Utility
License: MIT License
Node.js Flow Control Utility
License: MIT License
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.