This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function carry(fn) { | |
var | |
slice = Array.prototype.slice | |
, soredArgs = slice.call(arguments, 1) | |
; | |
return function() { | |
var | |
newArgs = slice.call(arguments) | |
, args = soredArgs.concat(newArgs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function namespace(ns_string) { | |
var | |
parts = ns_string.split('.') | |
, parent = MYAPP | |
, i | |
, length | |
; | |
// отбросить начальный префикс – имя глобального объекта | |
if (parts[0] === 'MYAPP') { | |
parts = parts.slice(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Sandbox() { | |
// преобразовать аргументы в массив | |
var | |
args = Array.prototype.slice.call(arguments) | |
// последний аргумент функция обратного вызова | |
, callback = args.pop() | |
// имена модулей могут передаваться в форме массива | |
// или в виде отдельных параметров | |
, modules = (args[0] && typeof args[0] === 'string') ? args : args[0] | |
, i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var constant = (function() { | |
var | |
constants = {} | |
, ownProp = Object.prototype.hasOwnProperty | |
, allowed = { | |
string: 1 | |
, number: 1 | |
, boolean: 1 | |
} | |
, prefix = (Math.random() + '_').slice(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var klass = function(Parent, props) { | |
var Child, i; | |
//новый конструктор | |
Child = function() { | |
if(Child.uber && Child.uber.hasOwnProperty('__constructor')) { | |
Child.uber.__constructor.apply(this, arguments); | |
} | |
if(Child.prototype.hasOwnProperty('__constructor')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extend(parent, child) { | |
var i; | |
child = child || {}; | |
for(i in parent) { | |
if(parent.hasOwnProperty(i)) { | |
child[i] = parent[i]; | |
} | |
} | |
return child; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BluePopup () { | |
//создание всплывающего окна | |
} | |
BluePopup.prototype.attach = function (elemens) { | |
//присоединение других ui-элементов к окну | |
} | |
BluePopupFactory.register('popup', BluePopup); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof Function.prototype.bind === 'undefined') { | |
Function.prototype.bind = function (thisArg) { | |
var | |
fn = this | |
, slice = Array.prototype.slice | |
, args = slice.call(arguments, 1) | |
; | |
return function () { | |
return fn.apply(thisArg, args.concat(slice.call(arguments))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extendDeep(parent, child) { | |
var | |
toStr = Object.prototype.toString | |
, astr = '[object Array]' | |
, i | |
; | |
child = child || {}; | |
for(i in parent) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.create || Object.create = function object(o) { | |
function F(){} | |
F.prototype = o; | |
return new F(); | |
} |
OlderNewer