Skip to content

Instantly share code, notes, and snippets.

@rochnyak-d-i
Created October 28, 2014 05:05
Show Gist options
  • Save rochnyak-d-i/bbe71ad718994bf70dbe to your computer and use it in GitHub Desktop.
Save rochnyak-d-i/bbe71ad718994bf70dbe to your computer and use it in GitHub Desktop.
JS шаблон команда
var CarManager = {
/* request information */
requestInfo:function (model, id) {
return 'The purchase info for ' + model + ' with ID ' + id + ' is being processed...';
},
/* purchase the car */
buyVehicle:function (model, id) {
return 'You have successfully purchased Item ' + id + ', a ' + model + '.';
}
};
CarManager.execute = function (commad) {
return CarManager[commad.request](commad.model, commad.carID);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment