_helpers.js 882 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. Meteor.publish('foo', function () {
  2. this.ready();
  3. });
  4. Meteor.publish('fooNotReady', function () {
  5. });
  6. Meteor.publish('bar', function () {
  7. this.ready();
  8. });
  9. // use this only to test global subs
  10. Meteor.publish('baz', function () {
  11. this.ready();
  12. });
  13. Meteor.publish('bazNotReady', function () {
  14. });
  15. Meteor.publish('readyness', function (doIt) {
  16. if(doIt) {
  17. this.ready();
  18. }
  19. });
  20. InjectData = Package['meteorhacks:inject-data'].InjectData;
  21. var urlResolve = Npm.require('url').resolve;
  22. GetFRData = function GetFRData(path) {
  23. var url = urlResolve(process.env.ROOT_URL, path);
  24. // FastRender only servers if there is a accept header with html in it
  25. var options = {
  26. headers: {'accept': 'html'}
  27. };
  28. var res = HTTP.get(url, options);
  29. var encodedData = res.content.match(/data">(.*)<\/script/)[1];
  30. return InjectData._decode(encodedData)['fast-render-data'];
  31. }