Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacobbubu/dnodehook
A quick demo to show how could we attach `pre` or `post` hooks to dnode methods.
https://github.com/jacobbubu/dnodehook
Last synced: 23 days ago
JSON representation
A quick demo to show how could we attach `pre` or `post` hooks to dnode methods.
- Host: GitHub
- URL: https://github.com/jacobbubu/dnodehook
- Owner: jacobbubu
- Created: 2016-01-22T10:05:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-22T10:05:48.000Z (about 9 years ago)
- Last Synced: 2024-11-13T16:12:07.957Z (3 months ago)
- Language: CoffeeScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Overview
This a quick demo to show how could we attach `pre` or `post` hooks to [dnode](https://github.com/substack/dnode) methods.## Install & Run
``` bash
npm i
```Run a vanilla [dnode](https://github.com/substack/dnode) demo.
``` bash
> npm test withoutHook.coffee
... some npm output
--original func calls
beep => BOOP
```And then you can run the hooked version:
``` bash
> npm test withHook.coffee
... some npm output
before transform
--original func calls
after transform!
beep => BOOP
```## How It works
I'm using [grappling-hook](https://github.com/keystonejs/grappling-hook) to do the hook things and just make the hooked object as clean as that could be transfered to the client.
See the source for the implementations.