- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
(function() {
var appBase = function( appId ) {
appId = appId || Math.floor( Math.random() * ( 1000 - 1 ) + 1 );
this.stack = {
methods: [ ], extends: { },
init: function( cfg ) {
this.creator( cfg );
this.bootstrap();
},
bootstrap: function() {
this.methods.init = null;
var param = new Object();
param.app = this.methods,
param.opt = this.setup;
param.__proto__ = null;
for( var i in this.setup.inits ) {
this.methods[ this.setup.inits[i] ].apply( param );
};
},
creator: function( cfg ) {
for( var mtd in cfg ) {
var flag = cfg[ mtd ].options[ 1 ] || null,
name = cfg[ mtd ].options[ 0 ] + "",
func = cfg[ mtd ].func;
this.methods[ name ] = func;
this.methods[ name ].name = name;
if( flag ) {
flag = flag.split('|');
if( flag[0] ) {
switch( flag[0] ) {
case 'init': this.setup.inits.push( name ); break;
case 'defer':
this.setup.defer.push( name );
this.setupTimer( [ flag[ 1 ], name, flag[ 2 ] - 0 ] );
break;
};
};
};
};
},
setupTimer: function( opt ) {
var tf = this.setup.timer[ opt[1] ],
tt = this.methods[ opt[1] ],
tm = opt[ 2 ] || 500;
switch( opt[0] ) {
case 'interval': tf = setInterval( tt, tm ); break;
case 'timeout': tf = setTimeout( tt, tm ); break;
};
},
flushTimer: function( id ) {
clearInterval( this.setup.defer[ id ] );
console.log( 'Interval '+ id +' Stoped!');
},
setup: {
appId: 'BiO Kernel' + appId, param: [ ], inits: [ ], defer: [ ],timer: [ ], flags: { }
}
};
this.stack.__proto__ = null; this.__proto__ = null;
};
var application = new appBase();
var app = application.stack;
var cfg = [
{
func: function() {
console.log( 'RUN [mtd_1] AT [init stage] => force [mtd_3]' );
this.app['mtd_3'].apply(this);
},
options: [ 'mtd_1' , 'init' ]
},
{
func: function() {
console.log( 'RUN [mtd_2] AT [init stage]' );
},
options: [ 'mtd_2' , 'init' ]
},
{
func: function() {
console.log( 'RUN [mtd_3] BY [mtd_1] FROM [init stage]' );
},
options: [ 'mtd_3' ]
},
{
func: function() {
console.log( 'run defered method #1 in timeout' );
},
options: [ 'deferedMethod_1', 'defer|timeout|8500' ]
},
{
func: function( ) {
console.log( 'run defered method #2 in interval' );
},
options: [ 'deferedMethod_2', 'defer|interval|500' ]
},
];
app.init( cfg, true );
})();
Съебаться из страны не получилось ): Оно не взламывалось вообще ... лимон так и не дали, а в жопу выебали через кого-то.