alias5.js 858 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Toaster singleton.
  3. *
  4. * @class
  5. */
  6. var Toaster = (function() {
  7. var instance = null;
  8. function Toaster() {}
  9. /**
  10. * Toast an item.
  11. *
  12. * @alias Toaster#toast
  13. * @param {BreadyThing} item - The item to toast.
  14. */
  15. Toaster.prototype.toast = function(item) {};
  16. /**
  17. * Clean the toaster.
  18. *
  19. * @alias clean
  20. * @memberof Toaster
  21. * @instance
  22. */
  23. Toaster.prototype.clean = function() {};
  24. return {
  25. /**
  26. * Get the Toaster instance.
  27. *
  28. * @alias Toaster.getInstance
  29. * @returns {Toaster} The Toaster instance.
  30. */
  31. getInstance: function() {
  32. if (instance === null) {
  33. instance = new Toaster();
  34. delete instance.constructor;
  35. }
  36. return instance;
  37. }
  38. };
  39. })();