Kogonuso / css3-mediaqueries-js

Automatically exported from code.google.com/p/css3-mediaqueries-js
0 stars 0 forks source link

Use a closure, one global, callbacks #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Since media queries are executed with a little bit of delay it would be useful 
if there was a way to run code after the update.

The easiest way would be adding a global so a timeout can be added to the 
resize event:

if (window.css3mq && css3mq.enabled) {
  setTimeout(function() { /* do stuff */ }, 1000);
}

Right now the only globals are things that probably shouldn't be global. It 
would be nice if everything was wrapped in a closure and only 1 global was 
exposed, providing a reliable check to see if the script is enabled. Maybe also 
avoid pushing a custom Object.create in there.

Better and more elegant would be a true callback system:

var callback = function() { /* do stuff */ };
css3mq.addCallback(callback);
css3mq.removeCallback(callback);

Having either one of those would make life easier.

Original issue reported on code.google.com by nickstak...@gmail.com on 23 Jul 2012 at 12:34

GoogleCodeExporter commented 9 years ago
Back from the dead... There is a new version of the script. It has some CSS 
parsing and processing improvements. If you're still using it, or would like to 
try again, could you confirm that this issue is solved or not?

Original comment by wou...@dynora.nl on 4 Apr 2014 at 11:46