Merge pull request #725 from kkujala/dev
Name anonymous functions in obj.js.
This commit is contained in:
commit
ea7e9aab9c
16
src/obj.js
16
src/obj.js
@ -642,7 +642,7 @@ var XRef = (function xRefXRef() {
|
||||
* inside of a worker. The `PDFObjects` implements some basic functions to
|
||||
* manage these objects.
|
||||
*/
|
||||
var PDFObjects = (function() {
|
||||
var PDFObjects = (function pdfObjects() {
|
||||
function PDFObjects() {
|
||||
this.objs = {};
|
||||
}
|
||||
@ -655,7 +655,7 @@ var PDFObjects = (function() {
|
||||
* Ensures there is an object defined for `objId`. Stores `data` on the
|
||||
* object *if* it is created.
|
||||
*/
|
||||
ensureObj: function(objId, data) {
|
||||
ensureObj: function pdfObjectsEnsureObj(objId, data) {
|
||||
if (this.objs[objId])
|
||||
return this.objs[objId];
|
||||
return this.objs[objId] = new Promise(objId, data);
|
||||
@ -670,7 +670,7 @@ var PDFObjects = (function() {
|
||||
* function and the object is already resolved, the callback gets called
|
||||
* right away.
|
||||
*/
|
||||
get: function(objId, callback) {
|
||||
get: function pdfObjectsGet(objId, callback) {
|
||||
// If there is a callback, then the get can be async and the object is
|
||||
// not required to be resolved right now
|
||||
if (callback) {
|
||||
@ -695,7 +695,7 @@ var PDFObjects = (function() {
|
||||
/**
|
||||
* Resolves the object `objId` with optional `data`.
|
||||
*/
|
||||
resolve: function(objId, data) {
|
||||
resolve: function pdfObjectsResolve(objId, data) {
|
||||
var objs = this.objs;
|
||||
|
||||
// In case there is a promise already on this object, just resolve it.
|
||||
@ -706,11 +706,11 @@ var PDFObjects = (function() {
|
||||
}
|
||||
},
|
||||
|
||||
onData: function(objId, callback) {
|
||||
onData: function pdfObjectsOnData(objId, callback) {
|
||||
this.ensureObj(objId).onData(callback);
|
||||
},
|
||||
|
||||
isResolved: function(objId) {
|
||||
isResolved: function pdfObjectsIsResolved(objId) {
|
||||
var objs = this.objs;
|
||||
if (!objs[objId]) {
|
||||
return false;
|
||||
@ -719,7 +719,7 @@ var PDFObjects = (function() {
|
||||
}
|
||||
},
|
||||
|
||||
hasData: function(objId) {
|
||||
hasData: function pdfObjectsHasData(objId) {
|
||||
var objs = this.objs;
|
||||
if (!objs[objId]) {
|
||||
return false;
|
||||
@ -731,7 +731,7 @@ var PDFObjects = (function() {
|
||||
/**
|
||||
* Sets the data of an object but *doesn't* resolve it.
|
||||
*/
|
||||
setData: function(objId, data) {
|
||||
setData: function pdfObjectsSetData(objId, data) {
|
||||
// Watchout! If you call `this.ensureObj(objId, data)` you're going to
|
||||
// create a *resolved* promise which shouldn't be the case!
|
||||
this.ensureObj(objId).data = data;
|
||||
|
Loading…
Reference in New Issue
Block a user