Code Monkey home page Code Monkey logo

Comments (2)

brianjmiller avatar brianjmiller commented on May 29, 2024
  1. The library at the moment probably isn't flexible enough to handle no auth being provided, but it should be I agree. I'll try to slate some time soon for it, but if you want to submit a PR that'd likely be faster.
  2. Since doing sync requests from Node.js is generally not suggested I don't have plans (nor would really accept the changes) to add sync handling to that particular environment file. The long term plan is to remove sync handling completely from both environments (node + browser) so that we can adopt a promises based approach.
  3. The callback arguments should be node conformant. Can you provide a code sample that doesn't work as expected? (Certainly have been issues in this area before, so I'm happy to check.) The arguments provided should be either null or the error message, and then the xhr that was used. Some calls do translation of the response on success, such as retrieveStatement which returns the TinCan.Statement itself as the second argument when possible. Trying to support backwards compat and effectively 3 environments (browser, IE, node) has been a pretty big pain, so there could certainly still be bugs in there. You might have a look at the test files for more sample code, or even better to create a test case that shows the issue you are running into. See:

https://github.com/RusticiSoftware/TinCanJS/tree/master/test/js/unit

The design of the API is lacking in this area as this was the first library created and based on an older design that was even less sufficient. I have it on my docket to solidify the context handling and callback structure to use proper response objects like the other OSS libraries have. Unfortunately I can't provide a timeline for any of that.

from tincanjs.

brianjmiller avatar brianjmiller commented on May 29, 2024

I should follow this up by saying that if you know what you are doing (and it sounds like you do) that it would be pretty easy to implement your own async handling that has a different callback argument structure and/or overall request handling (for instance to use Node's builtin HTTP client lib or the request lib from npm). Take a look at the current Environment/Node.js file and you can see that it is really just one method that needs to be overloaded:

https://github.com/RusticiSoftware/TinCanJS/blob/master/src/Environment/Node.js

It doesn't help you with the call structure, but it is a pretty isolated piece of code otherwise, particularly if you are controlling your environment.

from tincanjs.

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.