evented alternatives and similar shards
Based on the "Misc" category.
Alternatively, view evented alternatives based on common mentions on social networks and blogs.
-
sentry
Build/Runs your crystal application, watches files, and rebuilds/restarts app on file changes -
immutable
Thread-safe, persistent, immutable collections for the Crystal language -
crystagiri
An Html parser library for Crystal (like Nokogiri for Ruby) -
crz
Functional programming library for https://github.com/crystal-lang/crystal -
crystal-web-framework-stars
โญ๏ธ Web frameworks for Crystal, most starred on Github -
cron_scheduler
Simple job scheduler with crontab patterns for Crystal Language. -
inflector.cr
Inflector shard for Crystal. A port of ActiveSupport::Inflector -
aasm.cr
:arrows_clockwise: Easy to use finite state machine for Crystal classes -
kreal
Kreal is a model sharing & RPC library built on and works with Kemal seamlessly. -
retriable.cr
Retriable.cr is a simple DSL to retry failed code blocks -
ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Crystal -
CrSerializer
Extensible annotation based serialization/deserialization library -
circuit_breaker
Implementation of the circuit breaker pattern in crystal -
burocracia.cr
No dependency Crystal shard to validate, generate and format Brazilian burocracias such as CPF, CNPJ and CEP -
wikicr
Wiki in crystal, using Markdown and Git, inspired by dokuwiki. Last features to build are pretty hard, if you have some time to help... :) -
m3u8
Generate and parse m3u8 playlists for HTTP Live Streaming (HLS) in Crystal. -
message_verifier.cr
Rails compatible MessageVerifier for Crystal-lang apps
Build time-series-based applications quickly and at scale.
Do you think we are missing an alternative of evented or a related project?
Popular Comparisons
README
Evented
A micro library providing Crystal objects with Publish-Subscribe capabilities
- Decouple core business logic from external concerns in Hexagonal style architectures
- Use as an alternative to callbacks and Observers
- Connect objects based on context without permanence
- React to events synchronously
Installation
Add this to your application's shard.yml
:
dependencies:
evented:
github: krisleech/evented
Usage
Publishing
By including Evented::Publisher
your objects get broadcast
and
subscribe
methods.
broadcast
can be called from within your object whenever you want to
broadcast a significant event.
require "evented"
class MyPublisher
include Evented::Publisher
def call(input)
result = do_something(input)
broadcast(:something_happened, result)
end
end
Subscribing
To subscribe an object to receive events include Evented::Subscriber
and
provide your own on_event
method which will receive 2 arguments, the
event_name
and payload
.
require "evented"
class MySubscriber
include Evented::Subscriber
def on_event(event_name, payload)
# ...
end
end
To subscribe the listener to a publisher:
publisher = MyPublisher.new
publisher.subscribe(MySubscriber.new)
publisher.call("hello")
In the above example the subscriber will have on_event(:something_happened, "hello")
called.
Development
Specs
crystal spec
Automatically run Specs
ls ./**/*.cr | entr crystal spec
Contributing
- Fork it ( https://github.com/krisleech/evented/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- Kris Leech - creator, maintainer