Giter Club home page Giter Club logo

zhihudailyfluxrrd's Introduction

知乎日报

本示例基于Flux架构,使用Retrofit RxJava Dagger2 Apollo (Compile-time RxBus)构建。

Flux架构

工程结构

示例预览

关于Flux中View的UI交互处理问题

考虑如下问题,从Activity_1点击按钮,跳转到Activity_2,此时按钮的点击是不是也要经过action->dispatcher->store->view这样的流动?

在我实践过后,我个人建议与业务相关的UI交互尽量走Flux的Action分发(例如点击按钮从服务器获取数据),纯粹的UI逻辑可以直接在View(这里指Flux中的View,例如Activity)中处理,例如页面跳转。

关于Dispatcher

Dispatcher在Flux中只应存在一个。

本示例中的Dispatcher只是简单的负责注册,取消注册,分发action,并没有实现通过调整回调方法的触发次序来管理Store之间的依赖关系,Store可以声明等待其他Store更新完毕再更新自己,也就是没有实现waitFor方法(以后会实现,因为需要恰当的使用场景)。

本示例中的Dispatcher中有关Store的注册与取消注册采用了订阅/取消模式,使用了第三方RxBus库Apollo来实现。

##API

本示例中的所有Api,都是通过izzyleung的分析而来,最终解释权归知乎所有。

开源许可

Apache License Version 2.0

zhihudailyfluxrrd's People

Contributors

sloaix avatar

Watchers

霜刃西瓜 avatar

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.