Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. get_time_offset = function(timezone_id){
  2. Timezone.findById(timezone_id, function(err, doc){
  3. if(err) {
  4. console.log(err);
  5. } else {
  6. console.log(doc.offset);
  7. }
  8. });
  9. }
  10.  
  11. get_time_offset = function(timezone_id){
  12. var offset;
  13. Timezone.findById(timezone_id, function(err, doc){
  14. if(err) {
  15. console.log(err);
  16. } else {
  17. offset = doc.offset;
  18. }
  19. });
  20. console.log(offset);
  21. }
  22.  
  23. var scope = {offset : 10};
  24. get_time_offset = function(timezone_id){
  25. Timezone.findById(timezone_id, function(err, doc, scope){
  26. if(err) {
  27. console.log(err);
  28. } else {
  29. scope.offset = doc.offset;
  30. }
  31. });
  32. }
  33. console.log(scope.offset);
  34.  
  35. var offset = {};
  36.  
  37. } else {
  38. offset = doc.offset;
  39. console.log('from inside ... ', offset);
  40. }
  41. });
  42. }
  43. console.log('from outside ... ', offset);
  44.  
  45. get_time_offset = function(timezone_id){
  46. var offset;
  47.  
  48. function processResult(val) {
  49. console.log(val);
  50. }
  51.  
  52. Timezone.findById(timezone_id, function(err, doc){
  53. if(err) {
  54. console.log(err);
  55. } else {
  56. offset = doc.offset;
  57. }
  58. processResult(offset);
  59. });
  60. }
  61.  
  62. get_time_offset = function(timezone_id, callback){
  63.  
  64. Timezone.findById(timezone_id, function(err, doc){
  65. if(err) {
  66. console.log(err);
  67. callback(false);
  68. } else {
  69. callback(doc.offset);
  70. }
  71. });
  72.  
  73. };
  74.  
  75. get_time_offset(5, function(offset){
  76. console.log(offset)
  77. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement