GithubHelp home page GithubHelp logo

twister-lib-js's People

Contributors

erkan-yilmaz avatar flipflopsimsommer avatar gabrielhesposito avatar tschaul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

twister-lib-js's Issues

Throw an error on bad JSON return

I tried this library out, but had problems with a syntax error that was thrown. It took me quite a bit of debugging before I figured out that the JSON.parse method on (in this case) r.283 of twisterResource.js was not placed within a try/catch statement.

What happened was, my RPC info was wrong, so the server answered with a 401 error instead of proper JSON. It would be great to display/throw a custom error message in this case, I think.

other than that: Great work! The examples are wonderful :-).

How to get a list of resources?

Hello!

I'm trying to create a simple wrapper in Node.js that people might access from over the internet to read data from the Twister network (so only the 'get' part, not the 'set'), to make, for instance, an embeddable Twister Updates widget that shows the last posts from a certain user.

What I am having trouble with, is what to do when calling a function like Twister.getUser(name).doLatestPostsUntil(), I end up with a recursive callback structure. It gets very hard to create a list from this to return to the browser. The basic example works: I push() the post to an array, and when I'm at the final post I want, I return the contents of the array to the user.

But what if I want to append the URL of the user's avatar in the results as well?
I end up with recursive function calls that are very hard to understand and control.

What am I doing wrong?

Sincerely,

~Qqwy

Implement bind-methods

Implement bind-methods (e.g. bindProfile(...) ) that repeatedly queries the resource and invokes a callback function for every update.

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.