ryanve / response.js

Responsive design toolkit
http://responsejs.com
Other
801 stars 123 forks source link

Deprecate utils #51

Open ryanve opened 10 years ago

ryanve commented 10 years ago

As of the forthcoming 0.9.0 release, all utility methods deprecated. See #19 for context.

0.9 may be the last release to include all these

jerseycheese commented 9 years ago

I'm slightly confused.

So if Response.crossover will be the new event function, how does one run breakpoint-specific JS code if Response.crossover only works when a breakpoint is crossed into?

For example, I'd create the breakpoint set like so:

Breakpoints = {
    SMALL: 320,
    MEDIUM: 768,
    LARGE: 960,
    WIDE: 1200  };
Response.create({
    prop: "width"
    , prefix: "min-width- r src"
    , breakpoints: [1201,961,769,320,0]
    , lazy: true
  });

Then I'd have a Response.crossover() to listen for width changes, like so...

Response.crossover('width', function() {
 // Small/medium code here (anything under 960px)
 if (R.band(Breakpoints.LARGE)) {
   // Large+ code here (anything 960px and wider)
 }
}

But then how do I properly fire some code that should happen in my Breakpoints.LARGE custom breakpoint on pageload? Just run it outside of crossover(), like this?

Response.crossover('width', function() {
 // Small/medium code here (anything under 960px)
}
if (R.band(Breakpoints.LARGE)) {
 // Large+ code here (anything 960px and wider)
}