mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 04:32:01 +03:00
29 lines
629 B
JavaScript
29 lines
629 B
JavaScript
var Person = Klass.extend(
|
|
/** @lends Person.prototype */
|
|
{
|
|
/** @constructs Person */
|
|
initialize: function(name) {
|
|
this.name = name;
|
|
},
|
|
|
|
/**
|
|
* Callback for `say`.
|
|
*
|
|
* @callback Person~sayCallback
|
|
* @param {?string} err - Information about the error, if any.
|
|
* @param {?string} message - The message.
|
|
*/
|
|
/**
|
|
* Speak a message asynchronously.
|
|
*
|
|
* @param {Person~sayCallback} cb
|
|
*/
|
|
say: function(message, cb) {
|
|
if (!message) {
|
|
cb('You forgot the message!');
|
|
}
|
|
|
|
cb(null, this.name + ' says: ' + message);
|
|
}
|
|
});
|