AmplifyJS 1.1 Executive Brief
Today, we are very happy to announce the release of AmplifyJS 1.1. This update comes with a couple of enhancements and bug fixes.
You can download the latest code bits here.
Here is a short summary of what's new in AmplifyJS 1.1.
FEATURE CHANGE: amplify.request
Requests made through amplify.request will always be resolved asynchronously, even if the resource invokes the callbacks immediately. This ensures that you will never have timing problems if the request definition is changed in the future.
ENHANCEMENT: amplify.request - added dataMap option
Data maps allow you to modify the data for an ajax request before the data is sent. You can use a hash to map keys or you can use a function for complete flexibility.
Using data maps
When searching Twitter, the key for the search phrase is q. If we want a more descriptive name, such as term, we can use a data map:
amplify.request.define( "twitter-search", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: {
term: "q"
}
});amplify.request( "twitter-search", { term: "amplifyjs" }, ... );Similarly, we can create a request that searches for mentions, by accepting a username:
amplify.request.define( "twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: function( data ) {
return {
q: "@" + data.user
};
}
});amplify.request( "twitter-mentions", { user: "amplifyjs" }, ... );FIX: amplify.core
Fixed race condition when unsubscribing inside a handler #21 View ticket.
FIX: amplfiy.core
Fixed bug with subscribing a handler to multiple topics (#18) View ticket.
FIX: amplify.store
Fixed userData detection in IE when userData is disabled #31/#17 View ticket.
FIX: amplify.store
Fixed expiration for in-memory storage (#23) View ticket.