mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(util) applyConstructor: util -> client
This commit is contained in:
parent
f81b643f29
commit
1a0ffd499e
2 changed files with 16 additions and 16 deletions
|
|
@ -119,7 +119,7 @@ var Util, DOM, CloudFunc, join;
|
|||
var Proto = CloudCmd[name];
|
||||
|
||||
if (!error && type.function(Proto))
|
||||
CloudCmd[name] = Util.applyConstructor(Proto, args);
|
||||
CloudCmd[name] = applyConstructor(Proto, args);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -128,6 +128,21 @@ var Util, DOM, CloudFunc, join;
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* apply arguemnts to constructor
|
||||
*
|
||||
* @param constructor
|
||||
* @param args
|
||||
*/
|
||||
function applyConstructor(constructor, args) {
|
||||
var F = function () {
|
||||
return constructor.apply(this, args);
|
||||
};
|
||||
|
||||
F.prototype = constructor.prototype;
|
||||
return new F();
|
||||
}
|
||||
|
||||
/** Конструктор CloudClient, который
|
||||
* выполняет весь функционал по
|
||||
* инициализации
|
||||
|
|
|
|||
15
lib/util.js
15
lib/util.js
|
|
@ -11,21 +11,6 @@
|
|||
function UtilProto() {
|
||||
var Util = this;
|
||||
|
||||
/*
|
||||
* apply arguemnts to constructor
|
||||
*
|
||||
* @param constructor
|
||||
* @param args
|
||||
*/
|
||||
this.applyConstructor = function(constructor, args) {
|
||||
var F = function () {
|
||||
return constructor.apply(this, args);
|
||||
};
|
||||
|
||||
F.prototype = constructor.prototype;
|
||||
return new F();
|
||||
};
|
||||
|
||||
/**
|
||||
* Функция ищет в имени файла расширение
|
||||
* и если находит возвращает true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue