javascript - publish application settings (not documents) in Meteor -


i have couple settings need in application. want make couple of them available on client. did:

meteor.startup(function () {     meteor.publish('settings', function () {         return {            isauth: false         } }); 

and i've subscription like

meteor.subscribe('settings'); 

this doesn't work @ all, somehow have feeling works collections. question how can these settings in client. also, these settings needed render stuff, need data during init!

if it's okay put configuration settings in code, marco says.

if want specify them in json configuration file, use meteor.settings - in public field in configuration file available on client in meteor.settings.public.

it possible publish/subscribe, it's overkill:

// on server meteor.publish("applicationsettings", function () {   this.added("settings", "arbitrary_string", {isauth: true});   this.ready(); });  // on client settings = new meteor.collection("settings"); // on client meteor.subscribe("applicationsettings"); // after subscription ready, // settings.findone() returns {_id: "arbitrary_string", isauth: true} 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -