web应用程序的gui风格事件

ffire的Python项目详细描述


https://travis-ci.org/ffireio/ffire-python.svg?branch=dev

Ffire允许您在web应用程序中使用GUI风格的事件驱动编程 10行或更少代码。

ffire可以用它的简单api来概括。

安装

pip install ffire

创建和触发事件

#: Order Creation API/Engine : Application One (France or Germany or Mars)fromffireimportfire#: Create is idempotent. You can call create multiple times without side effects#: in addition it is more advisable to use constants i.e. ORDER_CREATED not literalsffire.create('order_created',category='event')#: Do application logic herepayload={"order_id":"abcd","client_id":"1234"}ffire('order_created',payload)#: ORffire.fire('order_created',payload)

订阅事件

# # Biryani Client : Application Two in (Brazil, South Africa or Venus)fromffireimportfireendpoint='http://api.example.com/order-created-handler'fire.subscribe('order_created',endpoint)#: Ffire assumes a handler for the payload sits at that endpoint.
  • 建议使用消息代理作为端点。然而,这不是强制性的,特别是在处理事件不是绝对必要的情况下。
  • 在这种情况下,任何端点都是足够的

使用事件

如果您希望显式使用ffire中的事件,可以这样做。

fromffireimportffirefire.consume('order_created',ffire.TIME_INTERVALS.ONE_HOUR)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
junit cucumber为什么会找到“runTest.java”来运行测试?   在Eclipse中找不到java KeyPairGenerator   java NotSerializableException即使在实现Serializable之后   noclassdeffounderror(java字符串连接)为什么会出现这种异常?   java Guice:将接口绑定到由动态代理创建的实例   使用Spring数据neo4j创建空间索引时发生java错误   java对于需要在50多个excel文件上运行并且每个文件平均包含25k行的项目,最佳的方法是什么   javaNIO中的java缓冲区写入/发送消息问题   如何在Java/eclipse中添加不调用super()的警告   JavaSpring:mvcUrl映射错误的id   java应该在getInstance或构造函数中使用Init方法吗?   安卓中的java空指针异常错误   java Jsoup不能完全获取原始html代码