Added createServer

This commit is contained in:
hydrabolt
2015-11-01 13:08:17 +00:00
parent b8aaa590b4
commit 0fe42c61da
10 changed files with 205 additions and 9 deletions

View File

@@ -235,6 +235,22 @@ var Client = (function (_EventEmitter) {
});
};
Client.prototype.createServer = function createServer(name) {
var region = arguments.length <= 1 || arguments[1] === undefined ? "london" : arguments[1];
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err, srv) {} : arguments[2];
var self = this;
return new Promise(function (resolve, reject) {
self.internal.createServer(name, region).then(function (srv) {
callback(null, srv);
resolve(srv);
})["catch"](function (e) {
callback(e);
reject(e);
});
});
};
return Client;
})(EventEmitter);