Created
August 28, 2014 23:26
-
-
Save dbarrionuevo/e1ae8797246aab2dea6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var NotificationsService = function () { | |
| this.MAX_LEN = 10; | |
| this.notificationsArchive = new NotificationsArchive(); | |
| this.notifications = []; | |
| }; | |
| NotificationsService.prototype.push = function (notification) { | |
| var newLen, notificationToArchive; | |
| newLen = this.notifications.unshift(notification); | |
| if (newLen > this.MAX_LEN) { | |
| notificationToArchive = this.notifications.pop(); | |
| this.notificationsArchive.archive(notificationToArchive); | |
| } | |
| }; | |
| NotificationsService.prototype.getCurrent = function () { | |
| return this.notifications; | |
| }; |
roperzh
commented
Aug 28, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment