Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.BBCImages.net = (function() {
- /**
- @private
- @name _constructUrl
- @function
- @param {BBCImages} An instance of the BBCImages core
- @param {int} Optional page number
- @description Examine an instance of bbcimages core and create an api url
- */
- var _constructUrl: function(imagesInstance, page) {
- if(imagesInstance.url.indexOf('/page/') == -1)
- {
- return imagesInstance.url.replace(/\/+$/,"")+'/page/'+page;
- }
- return imagesInstance.url.replace(/\/page\/(\b[1-9][0-9]{0,4})/, '\/page\/'+page);
- }
- return {
- /**
- @public
- @name GET
- @function
- @param {BBCImages} An instance of the BBCImages core
- @param {int} Optional page number
- @description Make an net request to BBCImages api for resource and page specified
- */
- get: function(imagesInstance, page) {
- var page = page || 1;
- //We could just pass the glow request object back for events to get tied to, for ease?
- return imagesInstance.glow.net.get(_constructUrl(imagesInstanc, page));
- }
- }
- }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement