Code Monkey home page Code Monkey logo

freesync's Introduction

FreeSync 一个轻量级消息总线

简介

  1. 仅有一个文件,两个类,6个方法。
  2. 内部使用 ConcurrentHashMap
  3. 支持多频道
  4. DSL语法让使用起来更爽
  5. 纯kotlin开发
  6. 等你自己发掘

使用方式

  1. 添加 FreeSync.kt 到项目中

  2. 添加订阅

 FreeSync.default().addCall<String>(key = this) {
 	log("订阅1:${it}")
 }
  1. 调用订阅
FreeSync.default().call<String>(key = this, value = "哈哈哈哈")

多渠道使用方式

  1. 通过FreeSync.with(key: Any)添加订阅
 FreeSync.with(key: Any).addCall<String>(key = this) {
 	log("订阅1:${it}")
 }
  1. 通过FreeSync.with(key: Any)调用订阅
FreeSync.with(key: Any).call<String>(key = this, value = "哈哈哈哈")

finally !!!

别忘了在不用的时候,调用 remove 掉不用的FreeSync或者Key

freesync's People

Contributors

songdehuai avatar

Stargazers

 avatar Doracoin avatar 小龙王 avatar  avatar Yesterday avatar

Watchers

James Cloos avatar  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.