any one can give some explanation about the following syntax:
clear: function(callback?: ?(error: ?Error) => void): Promise {
// balabala here
}
anyone can help?
They're flow declarations (http://flowtype.org) where there may be callback and/or an error and it returns a Promise.
You can call clear() for instance:
/* flow */
...
clear((data) => {
...do something with *data*, like resolve the promise ...
}, (error) => {
...handle *error*, like reject the promise ...
})
...
and it will return you a Promise object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With