Skip to content

Commit

Permalink
Move the check for css to be loaded out of a string into code
Browse files Browse the repository at this point in the history
  • Loading branch information
Naomi Seyfer committed Dec 13, 2013
1 parent 4ab6f8e commit 5750dcd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/webapp/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Npm.depends({connect: "2.9.0",

Package.on_use(function (api) {
api.use(['logging', 'underscore', 'routepolicy'], 'server');
api.use(['underscore'], 'client');
api.use(['application-configuration', 'follower-livedata'], {
unordered: true
});
Expand All @@ -19,5 +20,6 @@ Package.on_use(function (api) {
// loaded after webapp.
api.export(['WebApp', 'main', 'WebAppInternals'], 'server');
api.add_files('webapp_server.js', 'server');
api.add_files('webapp_client.js', 'client');
api.add_files('css_detect.css', 'client');
});
7 changes: 7 additions & 0 deletions packages/webapp/webapp_client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Meteor._isCssLoaded = function () {
return _.find(document.styleSheets, function (sheet) {
return _.find(sheet.cssRules, function (rule) {
return rule.selectorText === '._meteor_detect_css';
});
});
};
6 changes: 1 addition & 5 deletions packages/webapp/webapp_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ var bundledJsCssPrefix;

var RELOAD_SAFETYBELT = "\n" +
"if (typeof Meteor === 'undefined' || \n" +
" ! _.find(document.styleSheets, function (sheet) { \n" +
" return _.find(sheet.cssRules, function (rule) { \n" +
" return rule.selectorText === '._meteor_detect_css'; \n" +
" }); \n" +
" })) \n" +
" ! Meteor._isCssLoaded()) \n" +
" document.location.reload(); \n";


Expand Down

0 comments on commit 5750dcd

Please sign in to comment.