diff --git a/package.json b/package.json index 2af77ab..0f4b500 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tabletop", - "version": "1.5.2", + "version": "1.5.3", "description": "**Tabletop.js** takes a Google Spreadsheet and makes it easily accessible through JavaScript. With zero dependencies!", "main": "src/tabletop.js", "directories": { diff --git a/src/tabletop.js b/src/tabletop.js index 9f7864f..ca0f2c3 100755 --- a/src/tabletop.js +++ b/src/tabletop.js @@ -455,7 +455,7 @@ options.tabletop.log('Missing data for ' + this.name + ', make sure you didn\'t forget column headers'); this.originalColumns = []; this.elements = []; - this.onReady.call(this); + this.ready(); return; } @@ -487,17 +487,13 @@ element.rowNumber = i + 1; } - if (options.postProcess) { - options.postProcess(element); - } - this.elements.push(element); } if (options.prettyColumnNames) { this.fetchPrettyColumns(); } else { - this.onReady.call(this); + this.ready(); } }; @@ -521,7 +517,16 @@ }); }, + beforeReady: function() { + if(this.postProcess) { + for (i = 0, ilen = this.elements.length; i < ilen; i++) { + this.postProcess(element); + } + } + }, + ready: function() { + this.beforeReady(); this.onReady.call(this); }, diff --git a/src/tabletop.min.js b/src/tabletop.min.js index 39aabc3..0961d77 100644 --- a/src/tabletop.min.js +++ b/src/tabletop.min.js @@ -1 +1 @@ -(function(){"use strict";var inNodeJS=typeof process!=="undefined"&&!process.browser;var request=function requestNotProvided(){throw new Error("The 'request' module is only available while running in Node.")};if(inNodeJS){request=require("request")}var supportsCORS=false;var inLegacyIE=false;try{var testXHR=new XMLHttpRequest;if(typeof testXHR.withCredentials!=="undefined"){supportsCORS=true}else{if("XDomainRequest"in window){supportsCORS=true;inLegacyIE=true}}}catch(e){}var indexOfProto=Array.prototype.indexOf;var ttIndexOf=function(array,item){var i=0,l=array.length;if(indexOfProto&&array.indexOf===indexOfProto){return array.indexOf(item)}for(;i1&&this.debug){this.log("WARNING You have more than one sheet but are using simple sheet mode! Don't blame me when something goes wrong.")}return this.models[this.modelNames[0]].all()}else{return this.models}},addWanted:function(sheet){if(ttIndexOf(this.wanted,sheet)===-1){this.wanted.push(sheet)}},loadSheets:function(data){var i,ilen;var toLoad=[];this.googleSheetName=data.feed.title.$t;this.foundSheetNames=[];for(i=0,ilen=data.feed.entry.length;i1&&this.debug){this.log("WARNING You have more than one sheet but are using simple sheet mode! Don't blame me when something goes wrong.")}return this.models[this.modelNames[0]].all()}else{return this.models}},addWanted:function(sheet){if(ttIndexOf(this.wanted,sheet)===-1){this.wanted.push(sheet)}},loadSheets:function(data){var i,ilen;var toLoad=[];this.googleSheetName=data.feed.title.$t;this.foundSheetNames=[];for(i=0,ilen=data.feed.entry.length;i