]> git.r.bdr.sh - rbdr/grafn/blob - doc/README.md
Initial release
[rbdr/grafn] / doc / README.md
1 ## Classes
2
3 <dl>
4 <dt><a href="#Grafn">Grafn</a></dt>
5 <dd></dd>
6 </dl>
7
8 ## Typedefs
9
10 <dl>
11 <dt><a href="#tVertex">tVertex</a> : <code>object</code></dt>
12 <dd><p>The definition of a vertex that can be executed in the graph.</p>
13 </dd>
14 </dl>
15
16 <a name="Grafn"></a>
17
18 ## Grafn
19 **Kind**: global class
20
21 * [Grafn](#Grafn)
22 * [new Grafn()](#new_Grafn_new)
23 * [.run(vertexName)](#Grafn+run)
24 * [.vertex(vertex)](#Grafn+vertex)
25 * [.toString()](#Grafn+toString) ⇒ <code>string</code>
26
27 <a name="new_Grafn_new"></a>
28
29 ### new Grafn()
30 Represents a graph of functions. You can call run on any specific vertex,
31 which will trigger execution of it and its dependencies.
32
33 It guarantees that each vertex will only run once.
34
35 It can be represented in graphviz format, highlighting fulfilled and
36 rejected vertices.
37
38 <a name="Grafn+run"></a>
39
40 ### grafn.run(vertexName)
41 Executes the named vertex and all its dependents
42
43 **Kind**: instance method of [<code>Grafn</code>](#Grafn)
44 **Throws**:
45
46 - Will throw an error if a requested vertex does not exist
47
48
49 | Param | Type | Description |
50 | --- | --- | --- |
51 | vertexName | <code>string</code> | the name of the vertex to run |
52
53 <a name="Grafn+vertex"></a>
54
55 ### grafn.vertex(vertex)
56 Adds a vertex to the graph.
57
58 **Kind**: instance method of [<code>Grafn</code>](#Grafn)
59
60 | Param | Type | Description |
61 | --- | --- | --- |
62 | vertex | [<code>tVertex</code>](#tVertex) | the definition of the vertex to add |
63
64 <a name="Grafn+toString"></a>
65
66 ### grafn.toString() ⇒ <code>string</code>
67 Converts the graph to a graphviz digraph. If vertices have been executed,
68 they will be highlighted depending on whether they fulfilled or rejected.
69
70 **Kind**: instance method of [<code>Grafn</code>](#Grafn)
71 **Returns**: <code>string</code> - The graphviz digraph representation
72 <a name="tVertex"></a>
73
74 ## tVertex : <code>object</code>
75 The definition of a vertex that can be executed in the graph.
76
77 **Kind**: global typedef
78 **Properties**
79
80 | Name | Type | Default | Description |
81 | --- | --- | --- | --- |
82 | name | <code>string</code> | | The name of the vertex |
83 | [dependencies] | <code>Array.&lt;string&gt;</code> | <code>[]</code> | The names of vertices that need to run before this one |
84 | action | <code>function</code> | | The action to execute |
85