blob: f4d7c1107e4ffeeeae7a5d5c99616600aa472357 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# API Notation
The following document attempts to define a legend for easy specification of APIs for components. Any suggestions to improve are welcome.
```
NameOfClass.WithPossibleNamespace
+ class property
- instance property
~> listened events (socket)
+> listened events (class/module)
-> listened events (instance)
<~ dispatched events (socket)
<+ dispatched events(class/module)
<- dispatched events (instance)
:: class method
# instance method
Other symbols
=> returns
->() callback return
[xx] optional
<xx> data type
Recommended order: class first, then sockets, then instance. Internally: Properties, events, methods.
// Anything after two forward slashes is a comment
```
Here's an example of usage
```
HypotheticalModule
+staticProperty <String>
+anotherStaticProperty <Boolean>
::toggleAnotherStaticProperty()
::setStaticProperty(newValue <String>)
-instanceProperty <Number>
-anotherInstanceProperty <String>
#instanceMethodSync([optionalParameter]<Boolean>) => resultOfCall <String>
#instanceMethodAsync(someValue <Number>, [callback] <Function>) ->(error <String|null>, result <Number|null>)
```
Here's another example but with events.
```
EventHypotheticalClass
+>AnotherClass<+staticEventToListen(eventData <PredefinedObject>)
<+staticEventDispatched(someData <SomeData>)
~>listenedSocketEvent(eventData <SomeObject>)
<~dispatchedSocketEvent(eventData <BlaBla>)
->AnotherClass<-instanceEventToListen(eventData <Object>)
<-instanceEventDispatched(specificDataType <DefinedObject>)
```
|