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