JSFiddle - React, Tailwind, and code Playground
by Deepak Kumar
HTML
<div id='first'></div>
<div id='second'></div>
<div id='third'></div>
<div class='firstc'></div>
<div class='secondc'></div>
JavaScript
/** @namespace Namespace for BI classes and functions. */
var BI_PAPER = BI_PAPER || {};
(function () {
var initializing = false,
fnTest = /xyz/.test(function () {
xyz;
}) ? /\b_super\b/ : /.*/;
this.Class = function () {};
Class.extend = function (prop) {
var _super = this.prototype;
initializing = true;
var prototype = new this();
initializing = false;
for (var name in prop) {
prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) {
return function () {
var tmp = this._super;
this._super = _super[name];
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) : prop[name];
}
function Class() {
if (!initializing && this.init) this.init.apply(this, arguments);
}
Class.prototype = prototype;
Class.constructor = Class;
Class.extend = arguments.callee;
return Class;
};
})();
// Simple inheritance code ends
BI_PAPER.Global = Class.extend({
ids: [
'first',
'second'],
classes: [
'firstc',
'secondc'],
init: function () {
this.setElementsAsObject();
},
iPrint: function () {
console.log('I am parent ka baap');
},
// Set id object
// @param String container
// @return Object
idToObject: function (container) {
return $('#' + container);
},
/**
* set containers visibility state events
* @return {object}
*/
setElementsAsObject: function () {
// Loop over each value in the array.
var _self = this;
// for IDs elements
$.each(this.ids, function (index, value) {
var obj =...