Skip to content

Instantly share code, notes, and snippets.

@attitude
Created November 18, 2014 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attitude/6f32f5106c1b3d598abb to your computer and use it in GitHub Desktop.
Save attitude/6f32f5106c1b3d598abb to your computer and use it in GitHub Desktop.
Description for my my friend's IT colleagues to explain them how to leave door open/closed properly.
/*! Closing the Door by Martin Adamko (c) 2014, MIT Licence */
var officeOfHelena = {
person: {
name: "Helena",
surname: "Székhelyi"
}
};
(function(office) {
var door = {
degree: 45,
openDoor: function(degree) {
this.degree = degree;
return this;
},
closeDoor: function() {
this.degree = 45;
return this;
}
},
API = {
enterOffice: function(openDegree, afterDegree) {
if (afterDegree === 45) {
door.openDoor(openDegree).closeDoor(45);
alert("Come in!");
return true;
}
alert("Try again, make sure the 2nd argument passed is 45.");
return false;
}
};
office.doorAPI = API;
}(officeOfHelena));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment