-
-
Save demirhancosku/b091d9c6adf249c3af3c44b4a537256d to your computer and use it in GitHub Desktop.
This file contains 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 Observable = require('FuseJS/Observable'); | |
var list = Observable(); | |
var create = function(vendor) { | |
var obj = {}; | |
obj.id = vendor.id; | |
obj.latitude = vendor.latitude; | |
obj.longitude = vendor.longitude; | |
obj.label = vendor.title; | |
obj.title = vendor.title; | |
obj.address = vendor.address; | |
obj.isOpen = vendor.is_open; | |
obj.category = vendor.category; | |
obj.distance = vendor.formated_distance.distance + vendor.formated_distance.distance_unit | |
if(vendor.is_open){ | |
obj.image = 'Assets/marker_active.png'; | |
} | |
else{ | |
obj.image = 'Assets/marker_passive.png' | |
} | |
return obj; | |
}; | |
var add = function(marker) { | |
//console.log('kontrol'); | |
//console.log(marker.id); | |
var flag = false; | |
var control = list.forEach(function(v) { | |
if(v.id === marker.id){ | |
//console.log('v:id' + v.id); | |
//console.log('market:id' + marker.id); | |
flag = true; | |
} | |
}); | |
if(!flag){ | |
list.add(marker); | |
} | |
//console.log('eklenmis'); | |
}; | |
var clear = function() { | |
list.clear(); | |
}; | |
module.exports = { | |
create : create, | |
add : add, | |
list : list, | |
clear : clear | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment