https://github.com/tailrecursion/bo
A minimal implementation of LightTable's BOT Architecture.
https://github.com/tailrecursion/bo
Last synced: 4 months ago
JSON representation
A minimal implementation of LightTable's BOT Architecture.
- Host: GitHub
- URL: https://github.com/tailrecursion/bo
- Owner: tailrecursion
- Created: 2014-09-21T13:36:35.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-09-02T17:04:59.000Z (almost 11 years ago)
- Last Synced: 2024-05-09T13:59:53.935Z (about 2 years ago)
- Language: HTML
- Size: 195 KB
- Stars: 9
- Watchers: 17
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BO
A minimal implementation of LightTable's [BOT Architecture](http://www.chris-granger.com/2013/01/24/the-ide-as-data/).
BO can be used to glue different parts within the application with behaviors.
It can help augment the Data Flow in javelin with
* Data Store
* Control Flow
# See
* [Entity Systems](http://entity-systems.wikidot.com/rdbms-with-code-in-systems)
# Protocol
```clojure
(defprotocol IBO
(add [this object-name object-map])
(get-object [this object-name])
(get-in-object [this object-name object-keys])
(update! [this object-name object-map])
(update-in! [this object-name object-keys value])
(rm [this object-name])
(objects [this])
(by-prop [this meta-info matcher])
(raise [this event-name input]))
```
# Example
```clojure
(ns tailrecursion.bo.test
(:require [tailrecursion.bo :as bo]))
(enable-console-print!)
(let [test-bo (bo/BO. (atom {}) (atom {:pc nil :frame []}))]
(bo/add test-bo :foo {:type :object :data 1 :behaviors [:baz]})
(bo/add test-bo :bar {:type :object :data 0})
(bo/update-in! test-bo :bar [:data] 2)
(println (bo/get-in-object test-bo :bar [:data]))
(bo/add test-bo :baz {:type :behavior
:events [:e]
:action (fn [this event-name input obj-name]
(println (str "got " input " for " obj-name " from " event-name)))
})
(bo/raise test-bo :e 5))
```
```
2
got 5 for :foo from :e
```
# Testing
```
$ lein cljsbuild auto
$ node target/test.js
```
# Status
Alpha.
## License
Copyright (c) Sreeharsha Mudivarti. All rights reserved.
The use and distribution terms for this software are
covered by the Eclipse Public License 1.0
(http://opensource.org/licenses/eclipse-1.0.php) which can be
found in the file epl-v10.html at the root of this
distribution. By using this software in any fashion, you are
agreeing to be bound by the terms of this license. You must not
remove this notice, or any other, from this software.