Skip to content

Instantly share code, notes, and snippets.

@dahoba
Created April 21, 2015 04:28
Show Gist options
  • Save dahoba/50b8986452968eb06f40 to your computer and use it in GitHub Desktop.
Save dahoba/50b8986452968eb06f40 to your computer and use it in GitHub Desktop.
Testing Closure Compiler Externs Extractor
/* Namespace */
var ProTag = (function() {
var dpiId = eval('__dpi' + new Date().getTime());
$('<div id=&quot;test&quot; >&nbsp;</div>').appendTo('body');
$('<div id=&quot;'+dpiId+'&quot; style=&quot;width:1in;height: 1in;display: none;&quot;></div>').appendTo('body');
var dpi = $('#'+dpiId).width();
$('#'+dpiId).remove();
return {
__generateId : 0,
ss : {
Context : {
getDefaultDpi : function() {
return 300;
}
},
util : {
},
shape : {
},
layout : {
},
component : {
},
model : {
},
state : {
canvas : {
}
}
}
}
})();
ProTag.Object = function(config) {
var self = this;
/* Private Function */
function generateId() {
return ProTag.__generateId++;
};
/* Private variable */
self.initialConfig = config || {};
self.id = 'protag-' + generateId();
/* Privileged function */
self.getId = function() {
return self.id;
};
self.getInitialConfig = function() {
return self.initialConfig;
};
ProTag.ss.util.apply(self, config);
};
window['Protag'] = ProTag;
// General constant
/**
* @const */
ProTag.Constant = {
GRID_SIZE : 8,
DEFUALT_PERCENT_ZOOM : 0.05, // 5%
DEFUALT_MIN_ZOOM : 0.1, // If the value is 0 will ignore.
DEFUALT_MAX_ZOOM : 1.5, // If the value is 0 will ignore.
ROW_SIZE : 5, // datasource row size default to show
ROW_DATASOURCE : 500 //datasource row size to save
};
/**
* the constant for barcode type
* @const
*/
ProTag.BarcodeType = {
EAN13 : 'EAN13',
EAN8 : 'EAN8',
UPCA : 'UPCA',
UPCE : 'UPCE'
};
/**
* the constant for source flag
* @const
*/
ProTag.SourceFlag = {
STATIC : 'static',
DYNAMIC : 'dynamic'
};
/**
* constant for ruler
* @const
*/
ProTag.RULER = {
SIZE : 35,
LINE_SIZE : 15
};
/** @const */
ProTag.Image = {
FILE_SIZE: 250 // in KB
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment