jQuery Roundup: 1.7 RC1, $.Callbacks, jquery.rss, sessionTimeout

25 Oct 2011 | By Alex Young | Tags jquery plugins rss events

Note: You can send your plugins and articles in for review through our contact form or @dailyjs.

jQuery 1.7 RC1

jQuery 1.7 RC1 has been released. Meanwhile, the jQuery Standards Team has been created, which aims to represent jQuery users to standards bodies such as the W3C and TC39.

The jQuery Standards Team is driven by jQuery team members Yehuda Katz and Paul Irish who some of you may know. Yeuhda and Paul have extenstively worked with standards bodies and browser vendors in a number of capacities over the years.

Demystifying jQuery 1.7’s $.Callbacks

In Demystifying jQuery 1.7’s $.Callbacks, Addy Osmani explains the origins of $.Callbacks and provides detailed examples on how to use it.

The general idea behind pub/sub (the Observer pattern) is the promotion of loose coupling in applications. Rather than single objects calling on the methods of other objects, an object instead subscribes to a specific task or activity of another object and is notified when it occurs.

Looking at the source in in jQuery 1.7 is interesting because $.Callbacks is now used in several places. For example, the new deferred.js is built with it, and ajax.js is as well.

I was trying to compare Node’s EventEmitter with $.Callbacks and discovered Comparison Between Different Observer Pattern Implementations by Miller Medeiros, which is an interesting post on this subject.

jquery.rss

jquery.rss (License: MIT) by Sascha Depold and DaWanda GmbH is an RSS reading and transformation library. It uses the Google Feed API to download feeds straight from the browser. It comes complete with support for simple templates and filtering:

$("#rss-feeds").rss("http://feeds.feedburner.com/premiumpixels", {
  // how many entries do you want? default: 4
  limit: 10,

  // will request the API via https; default: false
  ssl: true,

  // template for the html transformation
  // default: "<ul>{entry}<li><a href='{url}'>[{author}@{date}] {title}</a><br/>{shortBodyPlain}</li>{/entry}</ul>"
  template: "<div class='feed-container'>{entry}<p>{title}</p>{/entry}</div>",

  // additional token definition for in-template-usage
  // default: {}
  tokens: {
    foo: 'bar',
    bar: function(entry, tokens) { return entry.title }
  }
});

sessionTimeout

sessionTimeout (Source: jquery.sessionTimeout.1.0.js) is a simple plugin for handling session timeouts in the browser. It will poll a URL, and show a jQuery UI dialog when the time limit has been reached.

$.sessionTimeout({
  message :     'Your session is about to expire.'
, keepAliveUrl: '/sessions/alive'
, redirUrl:     '/sessions/timed-out'
, logoutUrl:    '/sessions/destroy'
, warnAfter:    900000
, redirAfter:   1200000
})

blog comments powered by Disqus