data api with io

This commit is contained in:
tmshv committed 2016-03-23 19:38:59 +03:00
1 parent 0ffa403b60
commit aea2b8ff25
18 files changed
+162 -94

No files matched your search

+2 -2
View File
@@ -43,7 +43,7 @@ import UppercaseFirst from './filters/UppercaseFirst';
import Bytes from './filters/Bytes';
import Ext from './filters/Ext';
// import IOService from './services/io';
import IOService from './services/io';
import MenuService from './services/menu';
import API from './services/api';
@@ -225,7 +225,7 @@ app.run(($location, $rootScope, $http) => {
[
API,
// IOService,
IOService,
MenuService,
RemoveHashtags,
RemoveNewline,
+11 -15
View File
@@ -27,14 +27,13 @@ function postText(post){
export default function(app) {
app.component('timeline', {
template: template,
controller: function($timeout, usSpinnerService, api){
controller: function($timeout, usSpinnerService, api, io){
let skip = 0;
let limit = 10;
this.feed = [];
this.timelineUpdating = false;
usSpinnerService.stop('timelineMore');
//usSpinnerService.spin("timelineMore");
function toInstagram(post){
//var author_id = personByInstagram(team.team, post.data.author);
@@ -68,7 +67,6 @@ export default function(app) {
else return post;
});
//skip++;
skip += limit;
this.feed = this.feed.concat(feed2);
this.showFooter = this.feed && this.feed.length;
@@ -77,18 +75,16 @@ export default function(app) {
this.loadNext();
// io.on('post', params => {
//let posts = params instanceof Array ? params : [params];
//
//let feed2 = posts.map(post => {
// if(post.type == 'instagram') return toInstagram(post);
// else return post;
//});
io.on('feed', feed => {
// console.log(feed);
//this.$apply(() => {
// this.feed = feed2.concat(this.feed);
//});
// });
feed = feed instanceof Array ? feed : [feed];
feed = feed.map(i => i.type === 'instagram' ? toInstagram(i) : i);
$timeout(()=>{
this.feed = feed.concat(this.feed);
}, 0);
});
}
});
};
};