Skip to content

Instantly share code, notes, and snippets.

@lemesdaniel
Created August 11, 2015 22:39
Show Gist options
  • Save lemesdaniel/c922a4732f446aa01693 to your computer and use it in GitHub Desktop.
Save lemesdaniel/c922a4732f446aa01693 to your computer and use it in GitHub Desktop.
var app = new Vue({
el: '#list',
data: {
posts: [
{
title: 'Como integrar o fanout com laravel'
},
]
}
})
var add = new Vue({
el: '#add',
data: {
title: '',
msg: ''
},
methods: {
addPost: function(e) {
e.preventDefault();
if (!this.title) return;
$.post('/novo', { title: this.title });
this.title = '';
this.msg = 'Adicionado com sucesso';
}
}
})
var client = new Faye.Client('http://9b1cf4d8.fanoutcdn.com/bayeux');
client.subscribe('/test', function (item) {
app.posts.push({ title: item.data.message })
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment