Simulate a utility like $q of AngularJS