Grapple v0.1.1 Grapple.Hook

This module provides a GenServer that is primarily responsible for subscribing to and broadcasting Webhooks. It also defines a Hook struct, and macros for defining hooks.

Summary

Functions

Executes an HTTP request for every Webhook of the specified topic

Clears out all webhooks from the stash

Returns all webhooks

Removes all webhooks under a certain topic, by topic name

Removes a single webhook by reference

Callback for subscribing a Webhook. Adds a unique ref, adds to the list, and returns the topic name and unique ref of that Webhook

If the server is about to exit (i.e. crashing), save the current state in the stash

Macros

Allows users to define hookable functions that automatically publish to subscribers whenever they are invoked

Provides a unique topic based on an arbitrary name and the lexical module

Functions

broadcast(topic)

Executes an HTTP request for every Webhook of the specified topic.

clear_webhooks()

Clears out all webhooks from the stash.

get_webhooks()

Returns all webhooks.

remove_topic(topic)

Removes all webhooks under a certain topic, by topic name.

remove_webhook(ref)

Removes a single webhook by reference.

subscribe(hook)

Callback for subscribing a Webhook. Adds a unique ref, adds to the list, and returns the topic name and unique ref of that Webhook.

terminate(reason, arg2)

If the server is about to exit (i.e. crashing), save the current state in the stash.

Macros

defhook(name, list)

Allows users to define hookable functions that automatically publish to subscribers whenever they are invoked

topicof(name)

Provides a unique topic based on an arbitrary name and the lexical module