Xonotic
promise.qh
Go to the documentation of this file.
1 #pragma once
2 
3 entityclass(Promise);
4 
5 #define Promise_new() Promise_new_(new_pure(Promise))
6 Promise Promise_new_(Promise this);
7 
11 void Promise_resolve(Promise this);
12 
13 #define Promise_then(this, handler, userdata) Promise_then_(this, Promise_new(), handler, userdata)
14 Promise Promise_then_(Promise this, Promise ret, Promise(Promise ret, entity result, entity userdata) handler, entity userdata);
15 
19 void Promise_reject(Promise this);
20 
21 #define Promise_catch(this, handler, userdata) Promise_catch_(this, Promise_new(), handler, userdata)
22 Promise Promise_catch_(Promise this, Promise ret, Promise(Promise ret, entity err, entity userdata) handler, entity userdata);
23 
24 // utils
25 
26 #ifndef MENUQC
27 
28 // TODO: support menu
29 Promise Promise_sleep(float n);
30 
31 #endif
void Promise_reject(Promise this)
notify all Promise_catch subscribers that this promise has rejected
Definition: promise.qc:79
void Promise_resolve(Promise this)
notify all Promise_then subscribers that this promise has resolved
Definition: promise.qc:60
entity() spawn
entityclass(Promise)
entity err
Definition: promise.qc:44
entity result
Definition: promise.qc:43
Promise Promise_catch_(Promise this, Promise ret, Promise(Promise ret, entity err, entity userdata) handler, entity userdata)
Promise Promise_sleep(float n)
Definition: promise.qc:206
Promise Promise_new_(Promise this)
Definition: promise.qc:51
Promise Promise_then_(Promise this, Promise ret, Promise(Promise ret, entity result, entity userdata) handler, entity userdata)
Definition: promise.qc:180