Friday, November 14, 2014

implementing javascript continuous callback

trying to figure out how to implement Facebook's message badge notification

probably it's as simple as a function calling itself over and over again - javascript lends itself to this kind of style, taking advantage of the non-blocking attribute. Although this might not be the optimal way of doing it - probably setting a boolean variable inside the loop to deactivate/reactivate it would be a good idea (deactivate when user activity is not detected and just reactivate otherwise)

$scope.messageCount would later be interpolated within the badge elements

var monitor = function() {
    setTimeout(function() {
        console.log('monitoring ..');
        MessageFactory.getMessages('545846a622f1a2a188405579', function(messages) {
            $scope.messages = messages;
            $scope.messageCount = messages.length;
        });
        monitor();
    }, $scope.global.refreshInterval);
};
monitor();

or probably I'm better off with an infinite loop?

- Rain

Thursday, November 13, 2014

project re-code

for more than 3 years I haven't written a single update. things happened and many things definitely changed. I have began to explore and research other web technologies, though not to a point of abandoning Java - it's my first love after all. I wish I could've documented all the things I have learned for the past few months - which somehow had significantly shaped the way I think about web programming.

most of my recent projects involve REST technologies coupled with Single Page Application frameworks - call to AngularJS, which at first I was very skeptic with, but eventually began to fell in love with. this journey opened up many doors which led me to NodeJS and MongoDB - which finally made me realise how powerful Javascript has become recently.

well this is my wake up call to word-engrave my new journey. let's see where technology could lead me this time - and hopefully change the world with it eventually

cheers,

- Rain

I have a new twitter handle @7th_coder (which will be my main developer twitter account - so anything related with coding stuff, it goes there)