CommandBus

码农软件 · 软件分类 · 其他(Others) · 2019-07-18 12:58:24

软件介绍

一个轻量级的 Command Bus 的实现,用 Swift 编写。

使用:

{
    "{CommandNameA}": "{CommandHandlerNameA}",
    "{CommandNameB}": "{CommandHandlerNameB}",
    "{CommandNameC}": "{CommandHandlerNameC}"
}
class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        /*** Register to the Command event ***/
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "onCommandHandled:", name:"COMMAND_DONE", object: nil)
        /*** Create the CommandBus ***/
        let commandBus: CommandBus = CommandBus(configurationFileName: "configuration")!
        /*** Create your own CommandHandler ***/
        let customCommand: CustomCommand = CustomCommand()
        /*** Send your commandHandler to the CommandBus with your event name ***/
        commandBus.handle(command: customCommand, commandHandledEvent: "COMMAND_DONE")
    }
    func onCommandHandled(notification: NSNotification) {
        /*** This method is called when the CommandHandler have done ***/
        print("Command Handled: \(notification.object!)")
    }
}


本文地址:https://codercto.com/soft/d/10400.html

离散数学及其应用(原书第4版)

离散数学及其应用(原书第4版)

Kenneth H.Rosen / 机械工业出版社 / 2002-1-1 / 75.00

离散数学及其应用:原书第4版,ISBN:9787111075776,作者:(美)Kenneth H.Rosen著;袁崇义[等]译一起来看看 《离散数学及其应用(原书第4版)》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具