Git Product home page Git Product logo

Comments (7)

JakeWharton avatar JakeWharton commented on July 30, 2024

We probably should hide dispatch better. What's your use case?

from otto.

brh avatar brh commented on July 30, 2024

Please don't. I am extending Bus to dispatch only on the UI thread (if it is going to an activity or a fragment). I was going to make a suggestion for Otto to do this by default, but then I heard a talk on infoq from Eric Burke and he said Square had internally debated that and decided against it, due to some ordering or something..

from otto.

JakeWharton avatar JakeWharton commented on July 30, 2024

Any reason you aren't moving to the main thread in post(Object)?

from otto.

brh avatar brh commented on July 30, 2024

Because I don't want all events to come off of the event thread only certain ones and probably at certain times. Some would be going to DB, for example getting from the web and then posting to another service to write to the db. Really taking the class doing 1 thing to an irritating level =-).

from otto.

brh avatar brh commented on July 30, 2024

Even better would be if I could have my own EventHandler be used by Otto (via a factory method or the likes) and then in my dispatch I wouldn't have to do any instanceof checking. Custom annotation would specify to be notified on UI thread.

...

Ignore the instanceof comment, just realized that won't work at all.

from otto.

JakeWharton avatar JakeWharton commented on July 30, 2024

Version 2 adds Handler and Producer interfaces to the public API as a consequence of using code-generation so I suppose there's the possibility of using your own. Will have to think on this a bit.

from otto.

JakeWharton avatar JakeWharton commented on July 30, 2024

#108 is the solution for this. Guava is looking to implement annotations which map to Executors on which the callbacks get run. A @MainThread annotation could run on one which wraps the main thread Handler. Closing since this issue is now redundant with that one.

from otto.

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.