stackp / promisejs Goto Github PK
View Code? Open in Web Editor NEWLightweight javascript implementation of promises.
Lightweight javascript implementation of promises.
This should be set through the promisejs options flag:
// xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
When set hardcoded, some users (like me) have problems with cross site scripting :-)
Very useful plugin. Thank you!
Why not publishing it to NPM repo and simplify its usage as a node package dependency?
Greetings!
Thanks for this library.
It would be great if promisejs could be installed via npm. Bower would be useful too but I don't personally need that.
I want to achieve something like this:
`promise.chain([
promise.get('some-url-1'),
promise.get('some-url-2'),
promise.get('some-url-3')
]).then(
function(err, n) {
// get the responses here ..
}
);`
Can you advise please.
It would be fantastic if promise.js would support a timeout feature.
In my case (mobile app with phonegap) I sometimes loose connectivity. Therefore it would be great if the request would be finished after a while and an error is thrown (or something like that)
A list of supported Browsers would be great
If I need to set a content type different from application/x-www-form-urlencoded, the code should not reset the content type header.
Possible fix: Just add a test if the the user provided a content-type header in the headers param.
Hi all,
Like the title says, is this library still being looked upon?
If so, I was testing out "promises" based functionality of my js on personal blog. Everything else works as one would expect however, the promise.post fails to pass on new FormData("myFormElement");
Now when its all text based, I can serialize and send it in data field. But my form data also has images / pdfs which I upload and that is not being received by the server and neither is it being sent (confirming that based on console checks and network tabs).
I checked the source and I see payload = _encode(data);
.
Any help?
Code I am using:
<form name="submitnewcontent" id="myForm" method="post" action="/submit">
<input type="text" name="Text" title="title" />
<br />
<input name="fileu" type="file" accept="image/*">
<br/>
<input type="submit" value="Go" id="submitbutton" />
</form>
<script>
$('#submitbutton').onclick(function(){
promise.post('/z/index.php',new FormData(document.getElementById("myForm")));
});
<script>
I don't know if it's indeed a bug; but if you write this
promise.join([]).then(function() { console.log('done!'); })
it never console.logs "done!".
Can you add a Bower Support for that?
Playing by using your library, I got an usual message "Refused to execute script from 'https://raw.github.com/stackp/promisejs/master/promise.min.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled." in Chrome.
The solution is to serve files using gh-pages because of Github evolution (https://github.com/blog/1482-heads-up-nosniff-header-support-coming-to-chrome-and-firefox)
Sorry if this has been answered but could not find by searching..
I need to access a custom response header (Date) in my ajax calls, how do I go about this?
Hi, I would like to use your library, but I do not see a license for it.
The text "This allows to write callbacks like this:" would read better as "This allows callbacks to be written like this:".
delete is a keyword in javascript and might lead to problems when use as an identifier (as done in the last line of promisjs)
I use this library to perform my AJAX calls and I've noticed that on MSIE 9, some AJAX (not all) would get aborted by the browser for no reason.
I've found this thread on StackOverflow http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 and tried the suggested fix and it seemed to work better (no more randomly aborted AJAX calls).
What I've done is define an empty function
xhr.onprogress = function () { };
in the first try...catch
block of the ajax
method.
Thanks for your time
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.