Created
March 15, 2010 18:20
-
-
Save bsingr/333129 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [...] | |
| wrapped_callback = function(response) { | |
| var new_content = response, | |
| all_content = ""; | |
| $.each(data_array, function(i, idata) { | |
| // extend the data object with the context | |
| //--------------------------------------- | |
| // dpree: | |
| // the following line eats some of my data, e.g.: {"items": myItems} | |
| //--------------------------------------- | |
| $.extend(idata, context); | |
| //--------------------------------------- | |
| // dpree: | |
| // i don't know for what the sammy-context is needed, but maybe we could do instead sth. like: | |
| // $.extend(idata, {"___context___": context}); | |
| //--------------------------------------- | |
| if ($.isFunction(engine)) { | |
| new_content = engine.apply(context, [response, idata]); | |
| } | |
| // collect the content | |
| all_content += new_content; | |
| // if callback exists call it for each iteration | |
| if (callback) { | |
| // return the result of the callback | |
| // (you can bail the loop by returning false) | |
| return callback.apply(context, [new_content, i]); | |
| } | |
| }); | |
| if (!callback) { context.swap(all_content); } | |
| context.trigger('changed'); | |
| }; | |
| [...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment