Vulcan/packages/nova-core/lib/containers/AppComposer.jsx

26 lines
681 B
React
Raw Normal View History

2016-03-27 16:32:29 +09:00
import { composeWithTracker } from 'react-komposer';
import Messages from '../messages.js';
2016-06-23 15:16:32 +09:00
import Events from "meteor/nova:events";
2016-03-27 16:32:29 +09:00
function composer(props, onData) {
const subscriptions = Telescope.subscriptions.map((sub) => Meteor.subscribe(sub.name, sub.arguments));
const data = {
currentUser: Meteor.user(),
actions: {call: Meteor.call},
events: Events,
messages: Messages
}
2016-03-27 16:32:29 +09:00
if (!subscriptions.length || _.every(subscriptions, handle => handle.ready())) {
data.ready = true;
2016-03-27 16:32:29 +09:00
onData(null, data);
} else {
onData(null, {ready: false});
}
}
module.exports = composeWithTracker(composer);
export default composeWithTracker(composer);