Skip to content

Instantly share code, notes, and snippets.

@hugoalmeidahh
Last active May 23, 2018 17:56
Show Gist options
  • Save hugoalmeidahh/754a276f234faa32519ff61a5fb0b950 to your computer and use it in GitHub Desktop.
Save hugoalmeidahh/754a276f234faa32519ff61a5fb0b950 to your computer and use it in GitHub Desktop.
my mock makers
<script>
var app = new Vue({
el: '#app',
data(){
return {
markers: [],
MID: 0,
currentInfoWindow: null,
options : {timeout: 10000, enableHighAccuracy: true},
}
},
methods: {
methods: {
getMarkers: mockasync(getAPI),
getAPI:function(){
return[
{
...
},
{...
},
]
},
mockasync:function(){
function mocked(){
var res = f.apply(this, arguments);
return new Promise(function(resolve, reject){
window.setTimeout(function(){
resolve({data: res});
}, 500);
});
}
return mocked;
},
reverseMessage: function () {
this.message = this.message.split('').reverse().join('')
}
},
mounted(){
function loadMarkers(lat, lng, km){
this.getMakers(lat, lng, km).then(function(result){ /* << == Esse está lá no methods ...*/
var records = result;
for (var i = 0; i < records.length; i++) {
var record = records[i];
}
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment