repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
basisjs/basisjs | src/basis/data/dataset/Merge.js | function(sources){
var exists = this.sourceValues_.map(function(sourceInfo){
return sourceInfo.source;
});
var inserted = [];
var deleted = [];
var delta;
if (!sources)
sources = [];
this.sourceDelta_ = {
inserted: inserted,
deleted: deleted
};
for (var i =... | javascript | function(sources){
var exists = this.sourceValues_.map(function(sourceInfo){
return sourceInfo.source;
});
var inserted = [];
var deleted = [];
var delta;
if (!sources)
sources = [];
this.sourceDelta_ = {
inserted: inserted,
deleted: deleted
};
for (var i =... | [
"function",
"(",
"sources",
")",
"{",
"var",
"exists",
"=",
"this",
".",
"sourceValues_",
".",
"map",
"(",
"function",
"(",
"sourceInfo",
")",
"{",
"return",
"sourceInfo",
".",
"source",
";",
"}",
")",
";",
"var",
"inserted",
"=",
"[",
"]",
";",
"var... | Synchonize sources list according new list.
@param {Array.<basis.data.ReadOnlyDataset>} sources | [
"Synchonize",
"sources",
"list",
"according",
"new",
"list",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/dataset/Merge.js#L478-L508 | train | |
basisjs/basisjs | src/basis.js | values | function values(object){
var result = [];
for (var key in object)
result.push(object[key]);
return result;
} | javascript | function values(object){
var result = [];
for (var key in object)
result.push(object[key]);
return result;
} | [
"function",
"values",
"(",
"object",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"object",
")",
"result",
".",
"push",
"(",
"object",
"[",
"key",
"]",
")",
";",
"return",
"result",
";",
"}"
] | Returns all property values of object.
@param {object} object Any object can has properties.
@return {Array.<object>} | [
"Returns",
"all",
"property",
"values",
"of",
"object",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L169-L176 | train |
basisjs/basisjs | src/basis.js | slice | function slice(source, keys){
var result = {};
if (!keys)
return extend(result, source);
for (var i = 0, key; key = keys[i++];)
if (key in source)
result[key] = source[key];
return result;
} | javascript | function slice(source, keys){
var result = {};
if (!keys)
return extend(result, source);
for (var i = 0, key; key = keys[i++];)
if (key in source)
result[key] = source[key];
return result;
} | [
"function",
"slice",
"(",
"source",
",",
"keys",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"keys",
")",
"return",
"extend",
"(",
"result",
",",
"source",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"key",
";",
"key",
... | Creates a slice of source object.
@param {object} source Any object can has properties.
@param {Array.<string>} keys Desired key set.
@return {object} New object with desired keys from source object. | [
"Creates",
"a",
"slice",
"of",
"source",
"object",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L184-L195 | train |
basisjs/basisjs | src/basis.js | splice | function splice(source, keys){
var result = {};
if (!keys)
return extend(result, source);
for (var i = 0, key; key = keys[i++];)
if (key in source)
{
result[key] = source[key];
delete source[key];
}
return result;
} | javascript | function splice(source, keys){
var result = {};
if (!keys)
return extend(result, source);
for (var i = 0, key; key = keys[i++];)
if (key in source)
{
result[key] = source[key];
delete source[key];
}
return result;
} | [
"function",
"splice",
"(",
"source",
",",
"keys",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"keys",
")",
"return",
"extend",
"(",
"result",
",",
"source",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"key",
";",
"key",
... | Creates a slice of source object and delete keys from source.
@param {object} source Any object can has properties.
@param {Array.<string>} keys Desired key set.
@return {object} New object with desired keys from source object.
TODO: fix case when keys is not passed; it returns copy of source,
but doesn't delete anythi... | [
"Creates",
"a",
"slice",
"of",
"source",
"object",
"and",
"delete",
"keys",
"from",
"source",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L205-L219 | train |
basisjs/basisjs | src/basis.js | merge | function merge(/* obj1 .. objN */){
var result = {};
for (var i = 0; i < arguments.length; i++)
extend(result, arguments[i]);
return result;
} | javascript | function merge(/* obj1 .. objN */){
var result = {};
for (var i = 0; i < arguments.length; i++)
extend(result, arguments[i]);
return result;
} | [
"function",
"merge",
"(",
"/* obj1 .. objN */",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"extend",
"(",
"result",
",",
"arguments",
"[",
"i",
... | Merge several objects into new object and returns it.
@param {...*} args
@return {object} | [
"Merge",
"several",
"objects",
"into",
"new",
"object",
"and",
"returns",
"it",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L226-L233 | train |
basisjs/basisjs | src/basis.js | iterate | function iterate(object, callback, thisObject){
var result = [];
for (var key in object)
result.push(callback.call(thisObject, key, object[key]));
return result;
} | javascript | function iterate(object, callback, thisObject){
var result = [];
for (var key in object)
result.push(callback.call(thisObject, key, object[key]));
return result;
} | [
"function",
"iterate",
"(",
"object",
",",
"callback",
",",
"thisObject",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"object",
")",
"result",
".",
"push",
"(",
"callback",
".",
"call",
"(",
"thisObject",
",",
"key"... | Returns list of callback call result for every object's key-value pair.
@param {object} object Any object can has properties.
@param {function(key, value)} callback
@param {*=} thisObject
@return {Array.<*>} | [
"Returns",
"list",
"of",
"callback",
"call",
"result",
"for",
"every",
"object",
"s",
"key",
"-",
"value",
"pair",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L242-L249 | train |
basisjs/basisjs | src/basis.js | factory | function factory(fn){
if (typeof fn != 'function')
fn = getter(fn);
var result = function(value){
return fn(value);
};
/** @cut */ result = devInfoResolver.patchFactory(result);
result.factory = FACTORY;
return result;
} | javascript | function factory(fn){
if (typeof fn != 'function')
fn = getter(fn);
var result = function(value){
return fn(value);
};
/** @cut */ result = devInfoResolver.patchFactory(result);
result.factory = FACTORY;
return result;
} | [
"function",
"factory",
"(",
"fn",
")",
"{",
"if",
"(",
"typeof",
"fn",
"!=",
"'function'",
")",
"fn",
"=",
"getter",
"(",
"fn",
")",
";",
"var",
"result",
"=",
"function",
"(",
"value",
")",
"{",
"return",
"fn",
"(",
"value",
")",
";",
"}",
";",
... | Make factory function from getter.
@param {function(value)|string} fn Base for getter.
@return {function(value)} Factory function. | [
"Make",
"factory",
"function",
"from",
"getter",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L566-L577 | train |
basisjs/basisjs | src/basis.js | publicCallback | function publicCallback(fn, permanent){
var name = 'basisjsCallback' + genUID();
global[name] = permanent ? fn : function(){
try {
// IE8 and lower can't delete from global
delete global[name];
} catch(e) {
global[name] = undefined;
}
return fn.apply(this, argum... | javascript | function publicCallback(fn, permanent){
var name = 'basisjsCallback' + genUID();
global[name] = permanent ? fn : function(){
try {
// IE8 and lower can't delete from global
delete global[name];
} catch(e) {
global[name] = undefined;
}
return fn.apply(this, argum... | [
"function",
"publicCallback",
"(",
"fn",
",",
"permanent",
")",
"{",
"var",
"name",
"=",
"'basisjsCallback'",
"+",
"genUID",
"(",
")",
";",
"global",
"[",
"name",
"]",
"=",
"permanent",
"?",
"fn",
":",
"function",
"(",
")",
"{",
"try",
"{",
"// IE8 and... | Generates name for function and registrates it in global scope.
@param {function()} fn Function that should available in global scope.
@param {boolean} permanent If false callback will be removed after fiest invoke.
@return {string} Function name in global scope. | [
"Generates",
"name",
"for",
"function",
"and",
"registrates",
"it",
"in",
"global",
"scope",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L594-L609 | train |
basisjs/basisjs | src/basis.js | devVerboseName | function devVerboseName(name, args, fn){
/** @cut */ return new Function(keys(args), 'return {"' + name + '": ' + fn + '\n}["' + name + '"]').apply(null, values(args));
/** @cut */ } | javascript | function devVerboseName(name, args, fn){
/** @cut */ return new Function(keys(args), 'return {"' + name + '": ' + fn + '\n}["' + name + '"]').apply(null, values(args));
/** @cut */ } | [
"function",
"devVerboseName",
"(",
"name",
",",
"args",
",",
"fn",
")",
"{",
"/** @cut */",
"return",
"new",
"Function",
"(",
"keys",
"(",
"args",
")",
",",
"'return {\"'",
"+",
"name",
"+",
"'\": '",
"+",
"fn",
"+",
"'\\n}[\"'",
"+",
"name",
"+",
"'\"... | dev mode only
@cut | [
"dev",
"mode",
"only"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L614-L616 | train |
basisjs/basisjs | src/basis.js | function(path){
path = (path || '')
.replace(PROTOCOL_RX, '/')
.replace(ORIGIN_RX, '/') // but cut off origin
.replace(SEARCH_HASH_RX, ''); // cut off query search and hash
// use link element as path resolver
var result = [];
var parts... | javascript | function(path){
path = (path || '')
.replace(PROTOCOL_RX, '/')
.replace(ORIGIN_RX, '/') // but cut off origin
.replace(SEARCH_HASH_RX, ''); // cut off query search and hash
// use link element as path resolver
var result = [];
var parts... | [
"function",
"(",
"path",
")",
"{",
"path",
"=",
"(",
"path",
"||",
"''",
")",
".",
"replace",
"(",
"PROTOCOL_RX",
",",
"'/'",
")",
".",
"replace",
"(",
"ORIGIN_RX",
",",
"'/'",
")",
"// but cut off origin",
".",
"replace",
"(",
"SEARCH_HASH_RX",
",",
"... | Normalize a string path, taking care of '..' and '.' parts.
When multiple slashes are found, they're replaced by a single one;
when the path contains a trailing slash, it is preserved.
Origin is not includes in result path.
@example
basis.path.normalize('/foo/bar//baz/asdf/quux/..');
// returns '/foo/bar/baz/asdf'
b... | [
"Normalize",
"a",
"string",
"path",
"taking",
"care",
"of",
"..",
"and",
".",
"parts",
".",
"When",
"multiple",
"slashes",
"are",
"found",
"they",
"re",
"replaced",
"by",
"a",
"single",
"one",
";",
"when",
"the",
"path",
"contains",
"a",
"trailing",
"sla... | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1044-L1071 | train | |
basisjs/basisjs | src/basis.js | function(path, ext){
var filename = utils.normalize(path).match(/[^\\\/]*$/);
filename = filename ? filename[0] : '';
if (ext == utils.extname(filename))
filename = filename.substring(0, filename.length - ext.length);
return filename;
} | javascript | function(path, ext){
var filename = utils.normalize(path).match(/[^\\\/]*$/);
filename = filename ? filename[0] : '';
if (ext == utils.extname(filename))
filename = filename.substring(0, filename.length - ext.length);
return filename;
} | [
"function",
"(",
"path",
",",
"ext",
")",
"{",
"var",
"filename",
"=",
"utils",
".",
"normalize",
"(",
"path",
")",
".",
"match",
"(",
"/",
"[^\\\\\\/]*$",
"/",
")",
";",
"filename",
"=",
"filename",
"?",
"filename",
"[",
"0",
"]",
":",
"''",
";",
... | Return the last portion of a path. Similar to node.js path.basename
or the Unix basename command.
@example
basis.path.basename('/foo/bar/baz.html'); // returns 'baz.html'
basis.path.basename('/foo/bar/baz.html', '.html'); // returns 'baz'
@param {string} path
@param {string=} ext
@return {string} | [
"Return",
"the",
"last",
"portion",
"of",
"a",
"path",
".",
"Similar",
"to",
"node",
".",
"js",
"path",
".",
"basename",
"or",
"the",
"Unix",
"basename",
"command",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1120-L1128 | train | |
basisjs/basisjs | src/basis.js | function(){
var args = arrayFrom(arguments).reverse();
var path = [];
var absoluteFound = false;
for (var i = 0; !absoluteFound && i < args.length; i++)
if (typeof args[i] == 'string')
{
path.unshift(args[i]);
absoluteFound = ABSOLUTE_RX.test(... | javascript | function(){
var args = arrayFrom(arguments).reverse();
var path = [];
var absoluteFound = false;
for (var i = 0; !absoluteFound && i < args.length; i++)
if (typeof args[i] == 'string')
{
path.unshift(args[i]);
absoluteFound = ABSOLUTE_RX.test(... | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"arrayFrom",
"(",
"arguments",
")",
".",
"reverse",
"(",
")",
";",
"var",
"path",
"=",
"[",
"]",
";",
"var",
"absoluteFound",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"!",
"absoluteF... | Resolves to to an absolute path.
If to isn't already absolute from arguments are prepended in right
to left order, until an absolute path is found. If after using all
from paths still no absolute path is found, the current location is
used as well. The resulting path is normalized, and trailing slashes
are removed unl... | [
"Resolves",
"to",
"to",
"an",
"absolute",
"path",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1153-L1171 | train | |
basisjs/basisjs | src/basis.js | function(from, to){
// it makes function useful with array iterate methods, i.e.
// ['foo', 'bar'].map(basis.path.relative)
if (typeof to != 'string')
{
to = from;
from = baseURI;
}
from = utils.normalize(from);
to = utils.normalize(to);
... | javascript | function(from, to){
// it makes function useful with array iterate methods, i.e.
// ['foo', 'bar'].map(basis.path.relative)
if (typeof to != 'string')
{
to = from;
from = baseURI;
}
from = utils.normalize(from);
to = utils.normalize(to);
... | [
"function",
"(",
"from",
",",
"to",
")",
"{",
"// it makes function useful with array iterate methods, i.e.",
"// ['foo', 'bar'].map(basis.path.relative)",
"if",
"(",
"typeof",
"to",
"!=",
"'string'",
")",
"{",
"to",
"=",
"from",
";",
"from",
"=",
"baseURI",
";",
"}... | Solve the relative path from from to to.
At times we have two absolute paths, and we need to derive the
relative path from one to the other. This is actually the reverse
transform of {basis.path.resolve}, which means we see that:
basis.path.resolve(from, basis.path.relative(from, to)) == basis.path.resolve(to)
If `t... | [
"Solve",
"the",
"relative",
"path",
"from",
"from",
"to",
"to",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1199-L1228 | train | |
basisjs/basisjs | src/basis.js | fetchConfig | function fetchConfig(){
var config = __config;
if (!config)
{
if (NODE_ENV)
{
// node.js env
basisFilename = process.basisjsFilename || __filename.replace(/\\/g, '/');
/** @cut */ if (process.basisjsConfig)
/** @cut */ {
/** @cut */ config = process.ba... | javascript | function fetchConfig(){
var config = __config;
if (!config)
{
if (NODE_ENV)
{
// node.js env
basisFilename = process.basisjsFilename || __filename.replace(/\\/g, '/');
/** @cut */ if (process.basisjsConfig)
/** @cut */ {
/** @cut */ config = process.ba... | [
"function",
"fetchConfig",
"(",
")",
"{",
"var",
"config",
"=",
"__config",
";",
"if",
"(",
"!",
"config",
")",
"{",
"if",
"(",
"NODE_ENV",
")",
"{",
"// node.js env",
"basisFilename",
"=",
"process",
".",
"basisjsFilename",
"||",
"__filename",
".",
"repla... | Fetch basis.js options from script's `basis-config` or `data-basis-config` attribute. | [
"Fetch",
"basis",
".",
"js",
"options",
"from",
"script",
"s",
"basis",
"-",
"config",
"or",
"data",
"-",
"basis",
"-",
"config",
"attribute",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1249-L1308 | train |
basisjs/basisjs | src/basis.js | processConfig | function processConfig(config){
// make a copy of config
config = slice(config);
// extend by default settings
complete(config, {
implicitExt: NODE_ENV ? true : false // true, false, 'warn'
});
// warn about extProto in basis-config, this option was removed in 1.3.0
/** @cut */ if (... | javascript | function processConfig(config){
// make a copy of config
config = slice(config);
// extend by default settings
complete(config, {
implicitExt: NODE_ENV ? true : false // true, false, 'warn'
});
// warn about extProto in basis-config, this option was removed in 1.3.0
/** @cut */ if (... | [
"function",
"processConfig",
"(",
"config",
")",
"{",
"// make a copy of config",
"config",
"=",
"slice",
"(",
"config",
")",
";",
"// extend by default settings",
"complete",
"(",
"config",
",",
"{",
"implicitExt",
":",
"NODE_ENV",
"?",
"true",
":",
"false",
"/... | Process config object and returns adopted config.
Special options:
- autoload: namespace that must be loaded right after core loaded
- path: dictionary of paths for root namespaces
- modules: dictionary of modules with options
Other options copy into basis.config as is. | [
"Process",
"config",
"object",
"and",
"returns",
"adopted",
"config",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1320-L1444 | train |
basisjs/basisjs | src/basis.js | createClass | function createClass(SuperClass){
var classId = classSeed++;
if (typeof SuperClass != 'function')
SuperClass = BaseClass;
/** @cut */ var className = '';
/** @cut */ for (var i = 1, extension; extension = arguments[i]; i++)
/** @cut */ if (typeof extension != 'function' && ext... | javascript | function createClass(SuperClass){
var classId = classSeed++;
if (typeof SuperClass != 'function')
SuperClass = BaseClass;
/** @cut */ var className = '';
/** @cut */ for (var i = 1, extension; extension = arguments[i]; i++)
/** @cut */ if (typeof extension != 'function' && ext... | [
"function",
"createClass",
"(",
"SuperClass",
")",
"{",
"var",
"classId",
"=",
"classSeed",
"++",
";",
"if",
"(",
"typeof",
"SuperClass",
"!=",
"'function'",
")",
"SuperClass",
"=",
"BaseClass",
";",
"/** @cut */",
"var",
"className",
"=",
"''",
";",
"/** @c... | Class constructor.
@param {function()} SuperClass Class that new one inherits of.
@param {...(object|function())} extensions Objects that extends new class prototype.
@return {function()} A new class. | [
"Class",
"constructor",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1541-L1659 | train |
basisjs/basisjs | src/basis.js | function(value){
if (value && value !== SELF && (typeof value == 'object' || (typeof value == 'function' && !isClass(value))))
return BaseClass.create.call(null, NewClass, value);
else
return value;
} | javascript | function(value){
if (value && value !== SELF && (typeof value == 'object' || (typeof value == 'function' && !isClass(value))))
return BaseClass.create.call(null, NewClass, value);
else
return value;
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"&&",
"value",
"!==",
"SELF",
"&&",
"(",
"typeof",
"value",
"==",
"'object'",
"||",
"(",
"typeof",
"value",
"==",
"'function'",
"&&",
"!",
"isClass",
"(",
"value",
")",
")",
")",
")",
"return",
... | auto extend creates a subclass | [
"auto",
"extend",
"creates",
"a",
"subclass"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1585-L1590 | train | |
basisjs/basisjs | src/basis.js | extendClass | function extendClass(source){
var proto = this.prototype;
if (typeof source == 'function' && !isClass(source))
source = source(this.superClass_.prototype, slice(proto));
if (source.prototype)
source = source.prototype;
for (var key in source)
{
var value = source... | javascript | function extendClass(source){
var proto = this.prototype;
if (typeof source == 'function' && !isClass(source))
source = source(this.superClass_.prototype, slice(proto));
if (source.prototype)
source = source.prototype;
for (var key in source)
{
var value = source... | [
"function",
"extendClass",
"(",
"source",
")",
"{",
"var",
"proto",
"=",
"this",
".",
"prototype",
";",
"if",
"(",
"typeof",
"source",
"==",
"'function'",
"&&",
"!",
"isClass",
"(",
"source",
")",
")",
"source",
"=",
"source",
"(",
"this",
".",
"superC... | Extend class prototype
@param {Object} source If source has a prototype, it will be used to extend current prototype.
@return {function()} Returns `this`. | [
"Extend",
"class",
"prototype"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1666-L1699 | train |
basisjs/basisjs | src/basis.js | function(){
var value = this.get();
var cursor = this;
while (cursor = cursor.handler)
cursor.fn.call(cursor.context, value);
} | javascript | function(){
var value = this.get();
var cursor = this;
while (cursor = cursor.handler)
cursor.fn.call(cursor.context, value);
} | [
"function",
"(",
")",
"{",
"var",
"value",
"=",
"this",
".",
"get",
"(",
")",
";",
"var",
"cursor",
"=",
"this",
";",
"while",
"(",
"cursor",
"=",
"cursor",
".",
"handler",
")",
"cursor",
".",
"fn",
".",
"call",
"(",
"cursor",
".",
"context",
","... | Call every attached callbacks with current token value. | [
"Call",
"every",
"attached",
"callbacks",
"with",
"current",
"token",
"value",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1963-L1969 | train | |
basisjs/basisjs | src/basis.js | function(){
var token = this.deferredToken;
if (!token)
{
token = this.deferredToken = new DeferredToken(this.get());
this.attach(token.set, token);
}
return token;
} | javascript | function(){
var token = this.deferredToken;
if (!token)
{
token = this.deferredToken = new DeferredToken(this.get());
this.attach(token.set, token);
}
return token;
} | [
"function",
"(",
")",
"{",
"var",
"token",
"=",
"this",
".",
"deferredToken",
";",
"if",
"(",
"!",
"token",
")",
"{",
"token",
"=",
"this",
".",
"deferredToken",
"=",
"new",
"DeferredToken",
"(",
"this",
".",
"get",
"(",
")",
")",
";",
"this",
".",... | Returns deferred token based on this token. Every token can has
only one it's own deferred token.
@return {basis.DeferredToken} | [
"Returns",
"deferred",
"token",
"based",
"on",
"this",
"token",
".",
"Every",
"token",
"can",
"has",
"only",
"one",
"it",
"s",
"own",
"deferred",
"token",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1976-L1986 | train | |
basisjs/basisjs | src/basis.js | function(fn){
var token = new Token();
var setter = function(value){
this.set(fn.call(this, value));
};
if (typeof fn != 'function')
fn = getter(fn);
setter.call(token, this.get());
this.attach(setter, token, token.destroy);
token.attach($undef, this, functio... | javascript | function(fn){
var token = new Token();
var setter = function(value){
this.set(fn.call(this, value));
};
if (typeof fn != 'function')
fn = getter(fn);
setter.call(token, this.get());
this.attach(setter, token, token.destroy);
token.attach($undef, this, functio... | [
"function",
"(",
"fn",
")",
"{",
"var",
"token",
"=",
"new",
"Token",
"(",
")",
";",
"var",
"setter",
"=",
"function",
"(",
"value",
")",
"{",
"this",
".",
"set",
"(",
"fn",
".",
"call",
"(",
"this",
",",
"value",
")",
")",
";",
"}",
";",
"if... | Creates new token from token that contains modified through fn value.
@param {function(value):value} fn
@return {*} | [
"Creates",
"new",
"token",
"from",
"token",
"that",
"contains",
"modified",
"through",
"fn",
"value",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L1993-L2016 | train | |
basisjs/basisjs | src/basis.js | function(){
if (this.deferredToken)
{
this.deferredToken.destroy();
this.deferredToken = null;
}
this.attach = $undef;
this.detach = $undef;
var cursor = this;
while (cursor = cursor.handler)
if (cursor.destroy)
cursor.destroy.call(cursor.con... | javascript | function(){
if (this.deferredToken)
{
this.deferredToken.destroy();
this.deferredToken = null;
}
this.attach = $undef;
this.detach = $undef;
var cursor = this;
while (cursor = cursor.handler)
if (cursor.destroy)
cursor.destroy.call(cursor.con... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"deferredToken",
")",
"{",
"this",
".",
"deferredToken",
".",
"destroy",
"(",
")",
";",
"this",
".",
"deferredToken",
"=",
"null",
";",
"}",
"this",
".",
"attach",
"=",
"$undef",
";",
"this",
".",
... | Actually it's not require invoke destroy method for token, garbage
collector have no problems to free token's memory when all references
to token are removed.
@destructor | [
"Actually",
"it",
"s",
"not",
"require",
"invoke",
"destroy",
"method",
"for",
"token",
"garbage",
"collector",
"have",
"no",
"problems",
"to",
"free",
"token",
"s",
"memory",
"when",
"all",
"references",
"to",
"token",
"are",
"removed",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L2024-L2041 | train | |
basisjs/basisjs | src/basis.js | function(searchElement, offset){
offset = parseInt(offset, 10) || 0;
if (offset < 0)
return -1;
for (; offset < this.length; offset++)
if (this[offset] === searchElement)
return offset;
return -1;
} | javascript | function(searchElement, offset){
offset = parseInt(offset, 10) || 0;
if (offset < 0)
return -1;
for (; offset < this.length; offset++)
if (this[offset] === searchElement)
return offset;
return -1;
} | [
"function",
"(",
"searchElement",
",",
"offset",
")",
"{",
"offset",
"=",
"parseInt",
"(",
"offset",
",",
"10",
")",
"||",
"0",
";",
"if",
"(",
"offset",
"<",
"0",
")",
"return",
"-",
"1",
";",
"for",
"(",
";",
"offset",
"<",
"this",
".",
"length... | JavaScript 1.6 | [
"JavaScript",
"1",
".",
"6"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L2882-L2890 | train | |
basisjs/basisjs | src/basis.js | function(callback, initialValue){
var len = this.length;
var argsLen = arguments.length;
// no value to return if no initial value and an empty array
if (len == 0 && argsLen == 1)
throw new TypeError();
var result;
var inited = 0;
if (argsLen > 1)
{
res... | javascript | function(callback, initialValue){
var len = this.length;
var argsLen = arguments.length;
// no value to return if no initial value and an empty array
if (len == 0 && argsLen == 1)
throw new TypeError();
var result;
var inited = 0;
if (argsLen > 1)
{
res... | [
"function",
"(",
"callback",
",",
"initialValue",
")",
"{",
"var",
"len",
"=",
"this",
".",
"length",
";",
"var",
"argsLen",
"=",
"arguments",
".",
"length",
";",
"// no value to return if no initial value and an empty array",
"if",
"(",
"len",
"==",
"0",
"&&",
... | JavaScript 1.8 | [
"JavaScript",
"1",
".",
"8"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis.js#L2935-L2960 | train | |
basisjs/basisjs | src/devpanel/view/file-graph/view/graph/index.js | function(){
return {
bindDragNDrop: function(node, handlers){
if (handlers)
{
var events = Viva.Graph.Utils.dragndrop(node.ui.element);
['onStart', 'onDrag', 'onStop'].forEach(function(name){
if (typeof handlers[name] === 'function')
events[name](... | javascript | function(){
return {
bindDragNDrop: function(node, handlers){
if (handlers)
{
var events = Viva.Graph.Utils.dragndrop(node.ui.element);
['onStart', 'onDrag', 'onStop'].forEach(function(name){
if (typeof handlers[name] === 'function')
events[name](... | [
"function",
"(",
")",
"{",
"return",
"{",
"bindDragNDrop",
":",
"function",
"(",
"node",
",",
"handlers",
")",
"{",
"if",
"(",
"handlers",
")",
"{",
"var",
"events",
"=",
"Viva",
".",
"Graph",
".",
"Utils",
".",
"dragndrop",
"(",
"node",
".",
"ui",
... | Default input manager listens to DOM events to process nodes drag-n-drop | [
"Default",
"input",
"manager",
"listens",
"to",
"DOM",
"events",
"to",
"process",
"nodes",
"drag",
"-",
"n",
"-",
"drop"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/devpanel/view/file-graph/view/graph/index.js#L189-L210 | train | |
basisjs/basisjs | src/basis/data/dataset/MapFilter.js | function(rule){
rule = basis.getter(rule || $true);
if (this.rule !== rule)
{
var oldRule = this.rule;
this.rule = rule;
this.emit_ruleChanged(oldRule);
/** @cut */ basis.dev.patchInfo(this, 'sourceInfo', {
/** @cut */ transform: this.rule
/** @cut */ });
retu... | javascript | function(rule){
rule = basis.getter(rule || $true);
if (this.rule !== rule)
{
var oldRule = this.rule;
this.rule = rule;
this.emit_ruleChanged(oldRule);
/** @cut */ basis.dev.patchInfo(this, 'sourceInfo', {
/** @cut */ transform: this.rule
/** @cut */ });
retu... | [
"function",
"(",
"rule",
")",
"{",
"rule",
"=",
"basis",
".",
"getter",
"(",
"rule",
"||",
"$true",
")",
";",
"if",
"(",
"this",
".",
"rule",
"!==",
"rule",
")",
"{",
"var",
"oldRule",
"=",
"this",
".",
"rule",
";",
"this",
".",
"rule",
"=",
"r... | Set new filter function.
@param {function(item:basis.data.Object):*|string} rule
@return {Object} Delta of member changes. | [
"Set",
"new",
"filter",
"function",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/dataset/MapFilter.js#L278-L294 | train | |
basisjs/basisjs | src/basis/data/dataset/MapFilter.js | function(){
var sourceMap = this.sourceMap_;
var memberMap = this.members_;
var curMember;
var newMember;
var curMemberId;
var newMemberId;
var sourceObject;
var sourceObjectInfo;
var inserted = [];
var deleted = [];
var delta;
for (var sourceObjectId in sourceMap)
{... | javascript | function(){
var sourceMap = this.sourceMap_;
var memberMap = this.members_;
var curMember;
var newMember;
var curMemberId;
var newMemberId;
var sourceObject;
var sourceObjectInfo;
var inserted = [];
var deleted = [];
var delta;
for (var sourceObjectId in sourceMap)
{... | [
"function",
"(",
")",
"{",
"var",
"sourceMap",
"=",
"this",
".",
"sourceMap_",
";",
"var",
"memberMap",
"=",
"this",
".",
"members_",
";",
"var",
"curMember",
";",
"var",
"newMember",
";",
"var",
"curMemberId",
";",
"var",
"newMemberId",
";",
"var",
"sou... | Apply transform for all source objects and rebuild member set.
@return {Object} Delta of member changes. | [
"Apply",
"transform",
"for",
"all",
"source",
"objects",
"and",
"rebuild",
"member",
"set",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/dataset/MapFilter.js#L300-L380 | train | |
basisjs/basisjs | src/basis/data/dataset/Slice.js | function(offset, limit){
var oldOffset = this.offset;
var oldLimit = this.limit;
var delta = false;
if (oldOffset != offset || oldLimit != limit)
{
this.offset = offset;
this.limit = limit;
delta = this.applyRule();
this.emit_rangeChanged(oldOffset, oldLimit);
}
r... | javascript | function(offset, limit){
var oldOffset = this.offset;
var oldLimit = this.limit;
var delta = false;
if (oldOffset != offset || oldLimit != limit)
{
this.offset = offset;
this.limit = limit;
delta = this.applyRule();
this.emit_rangeChanged(oldOffset, oldLimit);
}
r... | [
"function",
"(",
"offset",
",",
"limit",
")",
"{",
"var",
"oldOffset",
"=",
"this",
".",
"offset",
";",
"var",
"oldLimit",
"=",
"this",
".",
"limit",
";",
"var",
"delta",
"=",
"false",
";",
"if",
"(",
"oldOffset",
"!=",
"offset",
"||",
"oldLimit",
"!... | Set new range for dataset.
@param {number} offset Start of range.
@param {number} limit Length of range.
@return {object|boolean} Delta of member changes. | [
"Set",
"new",
"range",
"for",
"dataset",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/dataset/Slice.js#L266-L282 | train | |
basisjs/basisjs | src/basis/data/dataset/Slice.js | function(rule, orderDesc){
rule = basis.getter(rule || $true);
orderDesc = !!orderDesc;
if (this.rule != rule || this.orderDesc != orderDesc)
{
var oldRule = this.rule;
var oldOrderDesc = this.orderDesc;
// rebuild index only if rule changing
if (this.rule != rule)
{
... | javascript | function(rule, orderDesc){
rule = basis.getter(rule || $true);
orderDesc = !!orderDesc;
if (this.rule != rule || this.orderDesc != orderDesc)
{
var oldRule = this.rule;
var oldOrderDesc = this.orderDesc;
// rebuild index only if rule changing
if (this.rule != rule)
{
... | [
"function",
"(",
"rule",
",",
"orderDesc",
")",
"{",
"rule",
"=",
"basis",
".",
"getter",
"(",
"rule",
"||",
"$true",
")",
";",
"orderDesc",
"=",
"!",
"!",
"orderDesc",
";",
"if",
"(",
"this",
".",
"rule",
"!=",
"rule",
"||",
"this",
".",
"orderDes... | Set new rule and order.
@param {function(item:basis.data.Object):*|string} rule
@param {boolean} orderDesc
@return {object} Delta of member changes. | [
"Set",
"new",
"rule",
"and",
"order",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/dataset/Slice.js#L308-L337 | train | |
basisjs/basisjs | src/basis/data/dataset/Slice.js | function(){
var start = this.offset;
var end = start + this.limit;
if (this.orderDesc)
{
start = this.index_.length - end;
end = start + this.limit;
}
var curSet = objectSlice(this.members_);
var newSet = this.index_.slice(Math.max(0, start), Math.max(0, end));
var inserted... | javascript | function(){
var start = this.offset;
var end = start + this.limit;
if (this.orderDesc)
{
start = this.index_.length - end;
end = start + this.limit;
}
var curSet = objectSlice(this.members_);
var newSet = this.index_.slice(Math.max(0, start), Math.max(0, end));
var inserted... | [
"function",
"(",
")",
"{",
"var",
"start",
"=",
"this",
".",
"offset",
";",
"var",
"end",
"=",
"start",
"+",
"this",
".",
"limit",
";",
"if",
"(",
"this",
".",
"orderDesc",
")",
"{",
"start",
"=",
"this",
".",
"index_",
".",
"length",
"-",
"end",... | Recompute slice.
@return {Object} Delta of member changes. | [
"Recompute",
"slice",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/dataset/Slice.js#L343-L395 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(){
// this -> {
// owner: owner,
// name: satelliteName,
// config: satelliteConfig,
// instance: satelliteInstance or null,
// instanceRA_: ResolveAdapter or null,
// existsRA_: ResolveAdapter or null
// factoryType: 'value' or 'class'
// factory: class or a... | javascript | function(){
// this -> {
// owner: owner,
// name: satelliteName,
// config: satelliteConfig,
// instance: satelliteInstance or null,
// instanceRA_: ResolveAdapter or null,
// existsRA_: ResolveAdapter or null
// factoryType: 'value' or 'class'
// factory: class or a... | [
"function",
"(",
")",
"{",
"// this -> {",
"// owner: owner,",
"// name: satelliteName,",
"// config: satelliteConfig,",
"// instance: satelliteInstance or null,",
"// instanceRA_: ResolveAdapter or null,",
"// existsRA_: ResolveAdapter or null",
"// factoryType: 'value' or 'clas... | satellite update handler | [
"satellite",
"update",
"handler"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L502-L609 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(name, satellite, autoSet){
var oldSatellite = this.satellite[name] || null;
var auto = this.satellite[AUTO];
var autoConfig = auto && auto[name];
var preserveAuto = autoSet && autoConfig;
if (preserveAuto)
{
satellite = autoConfig.instance;
if (satellite && ... | javascript | function(name, satellite, autoSet){
var oldSatellite = this.satellite[name] || null;
var auto = this.satellite[AUTO];
var autoConfig = auto && auto[name];
var preserveAuto = autoSet && autoConfig;
if (preserveAuto)
{
satellite = autoConfig.instance;
if (satellite && ... | [
"function",
"(",
"name",
",",
"satellite",
",",
"autoSet",
")",
"{",
"var",
"oldSatellite",
"=",
"this",
".",
"satellite",
"[",
"name",
"]",
"||",
"null",
";",
"var",
"auto",
"=",
"this",
".",
"satellite",
"[",
"AUTO",
"]",
";",
"var",
"autoConfig",
... | Set replace satellite with defined name for new one.
@param {string} name Satellite name.
@param {basis.data.Object} satellite New satellite node.
@param {boolean} autoSet Method invoked by auto-create | [
"Set",
"replace",
"satellite",
"with",
"defined",
"name",
"for",
"new",
"one",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L1136-L1316 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(newNode, refNode){
var nodes = this.nodes;
var pos = refNode ? nodes.indexOf(refNode) : -1;
if (pos == -1)
{
nodes.push(newNode);
this.last = newNode;
}
else
nodes.splice(pos, 0, newNode);
this.first = nodes[0];
newNode.groupNode = this... | javascript | function(newNode, refNode){
var nodes = this.nodes;
var pos = refNode ? nodes.indexOf(refNode) : -1;
if (pos == -1)
{
nodes.push(newNode);
this.last = newNode;
}
else
nodes.splice(pos, 0, newNode);
this.first = nodes[0];
newNode.groupNode = this... | [
"function",
"(",
"newNode",
",",
"refNode",
")",
"{",
"var",
"nodes",
"=",
"this",
".",
"nodes",
";",
"var",
"pos",
"=",
"refNode",
"?",
"nodes",
".",
"indexOf",
"(",
"refNode",
")",
":",
"-",
"1",
";",
"if",
"(",
"pos",
"==",
"-",
"1",
")",
"{... | Works like insertBefore, but don't update newNode references.
@param {basis.dom.wrapper.AbstractNode} newNode
@param {basis.dom.wrapper.AbstractNode} refNode | [
"Works",
"like",
"insertBefore",
"but",
"don",
"t",
"update",
"newNode",
"references",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L1463-L1480 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(oldNode){
var nodes = this.nodes;
if (arrayRemove(nodes, oldNode))
{
this.first = nodes[0] || null;
this.last = nodes[nodes.length - 1] || null;
oldNode.groupNode = null;
this.emit_childNodesModified({ deleted: [oldNode] });
}
if (!this.first && t... | javascript | function(oldNode){
var nodes = this.nodes;
if (arrayRemove(nodes, oldNode))
{
this.first = nodes[0] || null;
this.last = nodes[nodes.length - 1] || null;
oldNode.groupNode = null;
this.emit_childNodesModified({ deleted: [oldNode] });
}
if (!this.first && t... | [
"function",
"(",
"oldNode",
")",
"{",
"var",
"nodes",
"=",
"this",
".",
"nodes",
";",
"if",
"(",
"arrayRemove",
"(",
"nodes",
",",
"oldNode",
")",
")",
"{",
"this",
".",
"first",
"=",
"nodes",
"[",
"0",
"]",
"||",
"null",
";",
"this",
".",
"last"... | Works like removeChild, but don't update oldNode references.
@param {basis.dom.wrapper.AbstractNode} oldNode | [
"Works",
"like",
"removeChild",
"but",
"don",
"t",
"update",
"oldNode",
"references",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L1486-L1499 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(matchFunction){
if (this.matchFunction != matchFunction)
{
var oldMatchFunction = this.matchFunction;
this.matchFunction = matchFunction;
for (var node = this.lastChild; node; node = node.previousSibling)
node.match(matchFunction);
this.emit_matchFunction... | javascript | function(matchFunction){
if (this.matchFunction != matchFunction)
{
var oldMatchFunction = this.matchFunction;
this.matchFunction = matchFunction;
for (var node = this.lastChild; node; node = node.previousSibling)
node.match(matchFunction);
this.emit_matchFunction... | [
"function",
"(",
"matchFunction",
")",
"{",
"if",
"(",
"this",
".",
"matchFunction",
"!=",
"matchFunction",
")",
"{",
"var",
"oldMatchFunction",
"=",
"this",
".",
"matchFunction",
";",
"this",
".",
"matchFunction",
"=",
"matchFunction",
";",
"for",
"(",
"var... | Set match function for child nodes.
@param {function(node):boolean} matchFunction | [
"Set",
"match",
"function",
"for",
"child",
"nodes",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L2539-L2550 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(selection, silent){
var oldSelection = this.selection;
if (selection instanceof Selection === false)
selection = selection ? new Selection(selection) : null;
if (oldSelection !== selection)
{
// change context selection for child nodes
updateNodeContextSelectio... | javascript | function(selection, silent){
var oldSelection = this.selection;
if (selection instanceof Selection === false)
selection = selection ? new Selection(selection) : null;
if (oldSelection !== selection)
{
// change context selection for child nodes
updateNodeContextSelectio... | [
"function",
"(",
"selection",
",",
"silent",
")",
"{",
"var",
"oldSelection",
"=",
"this",
".",
"selection",
";",
"if",
"(",
"selection",
"instanceof",
"Selection",
"===",
"false",
")",
"selection",
"=",
"selection",
"?",
"new",
"Selection",
"(",
"selection"... | Changes selection property of node.
@param {basis.dom.wrapper.Selection=} selection New selection value for node.
@return {boolean} Returns true if selection was changed. | [
"Changes",
"selection",
"property",
"of",
"node",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L2754-L2780 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(selected, multiple){
var selection = this.contextSelection;
selected = !!resolveValue(this, this.setSelected, selected, 'selectedRA_');
// special case, when node selected and has selection context check only
// resolve adapter influence on selected if exists, and restore selection
... | javascript | function(selected, multiple){
var selection = this.contextSelection;
selected = !!resolveValue(this, this.setSelected, selected, 'selectedRA_');
// special case, when node selected and has selection context check only
// resolve adapter influence on selected if exists, and restore selection
... | [
"function",
"(",
"selected",
",",
"multiple",
")",
"{",
"var",
"selection",
"=",
"this",
".",
"contextSelection",
";",
"selected",
"=",
"!",
"!",
"resolveValue",
"(",
"this",
",",
"this",
".",
"setSelected",
",",
"selected",
",",
"'selectedRA_'",
")",
";",... | Set new value for selected property.
@param {boolean} selected Should be node selected or not.
@param {boolean} multiple Apply new state in multiple select mode or not.
@return {boolean} Returns true if selected property was changed. | [
"Set",
"new",
"value",
"for",
"selected",
"property",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L2788-L2869 | train | |
basisjs/basisjs | src/basis/dom/wrapper.js | function(disabled){
disabled = !!resolveValue(this, this.setDisabled, disabled, 'disabledRA_');
if (this.disabled !== disabled)
{
this.disabled = disabled;
if (!this.contextDisabled)
if (disabled)
this.emit_disable();
else
this.emit_enable(... | javascript | function(disabled){
disabled = !!resolveValue(this, this.setDisabled, disabled, 'disabledRA_');
if (this.disabled !== disabled)
{
this.disabled = disabled;
if (!this.contextDisabled)
if (disabled)
this.emit_disable();
else
this.emit_enable(... | [
"function",
"(",
"disabled",
")",
"{",
"disabled",
"=",
"!",
"!",
"resolveValue",
"(",
"this",
",",
"this",
".",
"setDisabled",
",",
"disabled",
",",
"'disabledRA_'",
")",
";",
"if",
"(",
"this",
".",
"disabled",
"!==",
"disabled",
")",
"{",
"this",
".... | Set new value for disabled property.
@param {boolean} disabled Should be node disabled or not.
@return {boolean} Returns true if disabled property was changed. | [
"Set",
"new",
"value",
"for",
"disabled",
"property",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/wrapper.js#L2905-L2922 | train | |
basisjs/basisjs | src/basis/data/AbstractData.js | function(isActive){
var proxyToken = this.activeRA_ && this.activeRA_.proxyToken;
if (isActive === PROXY)
{
if (!proxyToken)
{
proxyToken = new basis.Token(this.subscriberCount > 0);
this.addHandler(ABSTRACTDATA_ACTIVE_SYNC_HANDLER, proxyToken);
}
isActive = proxyTo... | javascript | function(isActive){
var proxyToken = this.activeRA_ && this.activeRA_.proxyToken;
if (isActive === PROXY)
{
if (!proxyToken)
{
proxyToken = new basis.Token(this.subscriberCount > 0);
this.addHandler(ABSTRACTDATA_ACTIVE_SYNC_HANDLER, proxyToken);
}
isActive = proxyTo... | [
"function",
"(",
"isActive",
")",
"{",
"var",
"proxyToken",
"=",
"this",
".",
"activeRA_",
"&&",
"this",
".",
"activeRA_",
".",
"proxyToken",
";",
"if",
"(",
"isActive",
"===",
"PROXY",
")",
"{",
"if",
"(",
"!",
"proxyToken",
")",
"{",
"proxyToken",
"=... | Set new value for isActiveSubscriber property.
@param {boolean} isActive New value for {basis.data.Object#active} property.
@return {boolean} Returns true if {basis.data.Object#active} was changed. | [
"Set",
"new",
"value",
"for",
"isActiveSubscriber",
"property",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/AbstractData.js#L235-L276 | train | |
basisjs/basisjs | src/basis/data/AbstractData.js | function(subscriptionType){
var curSubscriptionType = this.subscribeTo;
var newSubscriptionType = subscriptionType & SUBSCRIPTION.ALL;
var delta = curSubscriptionType ^ newSubscriptionType;
if (delta)
{
this.subscribeTo = newSubscriptionType;
if (this.active)
SUBSCRIPTION.chang... | javascript | function(subscriptionType){
var curSubscriptionType = this.subscribeTo;
var newSubscriptionType = subscriptionType & SUBSCRIPTION.ALL;
var delta = curSubscriptionType ^ newSubscriptionType;
if (delta)
{
this.subscribeTo = newSubscriptionType;
if (this.active)
SUBSCRIPTION.chang... | [
"function",
"(",
"subscriptionType",
")",
"{",
"var",
"curSubscriptionType",
"=",
"this",
".",
"subscribeTo",
";",
"var",
"newSubscriptionType",
"=",
"subscriptionType",
"&",
"SUBSCRIPTION",
".",
"ALL",
";",
"var",
"delta",
"=",
"curSubscriptionType",
"^",
"newSub... | Set new value for subscriptionType property.
@param {number} subscriptionType New value for {basis.data.Object#subscribeTo} property.
@return {boolean} Returns true if {basis.data.Object#subscribeTo} was changed. | [
"Set",
"new",
"value",
"for",
"subscriptionType",
"property",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/AbstractData.js#L283-L299 | train | |
basisjs/basisjs | src/basis/data/AbstractData.js | function(syncAction){
var oldAction = this.syncAction;
if (typeof syncAction != 'function')
syncAction = null;
this.syncAction = syncAction;
if (syncAction)
{
if (!oldAction)
this.addHandler(this.syncEvents);
if (this.isSyncRequired())
callSyncAction(this);
}... | javascript | function(syncAction){
var oldAction = this.syncAction;
if (typeof syncAction != 'function')
syncAction = null;
this.syncAction = syncAction;
if (syncAction)
{
if (!oldAction)
this.addHandler(this.syncEvents);
if (this.isSyncRequired())
callSyncAction(this);
}... | [
"function",
"(",
"syncAction",
")",
"{",
"var",
"oldAction",
"=",
"this",
".",
"syncAction",
";",
"if",
"(",
"typeof",
"syncAction",
"!=",
"'function'",
")",
"syncAction",
"=",
"null",
";",
"this",
".",
"syncAction",
"=",
"syncAction",
";",
"if",
"(",
"s... | Change sync actions function.
@param {function|null} syncAction | [
"Change",
"sync",
"actions",
"function",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/AbstractData.js#L313-L333 | train | |
basisjs/basisjs | src/basis/data/resolve.js | createResolveFunction | function createResolveFunction(Class){
return function resolve(context, fn, source, property, factoryContext){
var oldAdapter = context[property] || null;
var newAdapter = null;
if (fn !== resolveAdapterProxy && typeof source == 'function')
source = source.call(factoryContext || context, factoryCon... | javascript | function createResolveFunction(Class){
return function resolve(context, fn, source, property, factoryContext){
var oldAdapter = context[property] || null;
var newAdapter = null;
if (fn !== resolveAdapterProxy && typeof source == 'function')
source = source.call(factoryContext || context, factoryCon... | [
"function",
"createResolveFunction",
"(",
"Class",
")",
"{",
"return",
"function",
"resolve",
"(",
"context",
",",
"fn",
",",
"source",
",",
"property",
",",
"factoryContext",
")",
"{",
"var",
"oldAdapter",
"=",
"context",
"[",
"property",
"]",
"||",
"null",... | Class instance resolve function factory | [
"Class",
"instance",
"resolve",
"function",
"factory"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/resolve.js#L63-L105 | train |
basisjs/basisjs | src/basis/data/resolve.js | resolveValue | function resolveValue(context, fn, source, property, factoryContext){
var oldAdapter = context[property] || null;
var newAdapter = null;
// as functions could be a value, invoke only functions with factory property
// i.e. source -> function(){ /* factory code */ }).factory === FACTORY
// apply only for top-... | javascript | function resolveValue(context, fn, source, property, factoryContext){
var oldAdapter = context[property] || null;
var newAdapter = null;
// as functions could be a value, invoke only functions with factory property
// i.e. source -> function(){ /* factory code */ }).factory === FACTORY
// apply only for top-... | [
"function",
"resolveValue",
"(",
"context",
",",
"fn",
",",
"source",
",",
"property",
",",
"factoryContext",
")",
"{",
"var",
"oldAdapter",
"=",
"context",
"[",
"property",
"]",
"||",
"null",
";",
"var",
"newAdapter",
"=",
"null",
";",
"// as functions coul... | Resolve value from source. | [
"Resolve",
"value",
"from",
"source",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/resolve.js#L110-L150 | train |
basisjs/basisjs | src/basis/data/dataset/Extract.js | function(){
var insertedMap = {};
var deletedMap = {};
var delta;
for (var key in this.sourceMap_)
{
var sourceObjectInfo = this.sourceMap_[key];
var sourceObject = sourceObjectInfo.source;
if (sourceObject instanceof DataObject)
{
var newValue = this.rule(sourceObj... | javascript | function(){
var insertedMap = {};
var deletedMap = {};
var delta;
for (var key in this.sourceMap_)
{
var sourceObjectInfo = this.sourceMap_[key];
var sourceObject = sourceObjectInfo.source;
if (sourceObject instanceof DataObject)
{
var newValue = this.rule(sourceObj... | [
"function",
"(",
")",
"{",
"var",
"insertedMap",
"=",
"{",
"}",
";",
"var",
"deletedMap",
"=",
"{",
"}",
";",
"var",
"delta",
";",
"for",
"(",
"var",
"key",
"in",
"this",
".",
"sourceMap_",
")",
"{",
"var",
"sourceObjectInfo",
"=",
"this",
".",
"so... | Re-apply rule to members.
@return {Object} Delta of member changes. | [
"Re",
"-",
"apply",
"rule",
"to",
"members",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data/dataset/Extract.js#L307-L363 | train | |
basisjs/basisjs | src/basis/net/action.js | createAction | function createAction(config){
// make a copy of config with defaults
config = basis.object.extend({
prepare: nothingToDo,
request: nothingToDo
}, config);
// if body is function take in account special action context
if (typeof config.body == 'function')
{
var bodyFn = config... | javascript | function createAction(config){
// make a copy of config with defaults
config = basis.object.extend({
prepare: nothingToDo,
request: nothingToDo
}, config);
// if body is function take in account special action context
if (typeof config.body == 'function')
{
var bodyFn = config... | [
"function",
"createAction",
"(",
"config",
")",
"{",
"// make a copy of config with defaults",
"config",
"=",
"basis",
".",
"object",
".",
"extend",
"(",
"{",
"prepare",
":",
"nothingToDo",
",",
"request",
":",
"nothingToDo",
"}",
",",
"config",
")",
";",
"// ... | Creates a function that init service transport if necessary and make a request.
@function | [
"Creates",
"a",
"function",
"that",
"init",
"service",
"transport",
"if",
"necessary",
"and",
"make",
"a",
"request",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/net/action.js#L111-L189 | train |
basisjs/basisjs | demo/apps/todomvc/basis/js/app.js | function(){
// set up router
router.route(/^\/(active|completed)$/).param(0).as(function(subset){
Todo.selected.set(Todo[subset || 'all']);
});
// return app root node
return new Node({
template: resource('./app/template/layout.tmpl'),
binding: {
// nested views
fo... | javascript | function(){
// set up router
router.route(/^\/(active|completed)$/).param(0).as(function(subset){
Todo.selected.set(Todo[subset || 'all']);
});
// return app root node
return new Node({
template: resource('./app/template/layout.tmpl'),
binding: {
// nested views
fo... | [
"function",
"(",
")",
"{",
"// set up router",
"router",
".",
"route",
"(",
"/",
"^\\/(active|completed)$",
"/",
")",
".",
"param",
"(",
"0",
")",
".",
"as",
"(",
"function",
"(",
"subset",
")",
"{",
"Todo",
".",
"selected",
".",
"set",
"(",
"Todo",
... | init method invoke on document ready | [
"init",
"method",
"invoke",
"on",
"document",
"ready"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/demo/apps/todomvc/basis/js/app.js#L11-L27 | train | |
basisjs/basisjs | src/basis/template/html.js | legacyAttrClass | function legacyAttrClass(domRef, oldClass, newValue, anim){
var newClass = newValue || '';
if (newClass != oldClass)
{
var className = domRef.className;
var classNameIsObject = typeof className != 'string';
var classList;
if (classNameIsObject)
className = c... | javascript | function legacyAttrClass(domRef, oldClass, newValue, anim){
var newClass = newValue || '';
if (newClass != oldClass)
{
var className = domRef.className;
var classNameIsObject = typeof className != 'string';
var classList;
if (classNameIsObject)
className = c... | [
"function",
"legacyAttrClass",
"(",
"domRef",
",",
"oldClass",
",",
"newValue",
",",
"anim",
")",
"{",
"var",
"newClass",
"=",
"newValue",
"||",
"''",
";",
"if",
"(",
"newClass",
"!=",
"oldClass",
")",
"{",
"var",
"className",
"=",
"domRef",
".",
"classN... | old browsers have no support for classList at all IE11 and lower doesn't support classList for SVG | [
"old",
"browsers",
"have",
"no",
"support",
"for",
"classList",
"at",
"all",
"IE11",
"and",
"lower",
"doesn",
"t",
"support",
"classList",
"for",
"SVG"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/template/html.js#L264-L308 | train |
basisjs/basisjs | src/basis/net/ajax.js | setRequestHeaders | function setRequestHeaders(xhr, requestData){
var headers = {};
if (IS_METHOD_WITH_BODY.test(requestData.method))
{
// when send a FormData instance, browsers serialize it and
// set correct content-type header with boundary
if (!FormData || requestData.body instanceof FormData == false)
... | javascript | function setRequestHeaders(xhr, requestData){
var headers = {};
if (IS_METHOD_WITH_BODY.test(requestData.method))
{
// when send a FormData instance, browsers serialize it and
// set correct content-type header with boundary
if (!FormData || requestData.body instanceof FormData == false)
... | [
"function",
"setRequestHeaders",
"(",
"xhr",
",",
"requestData",
")",
"{",
"var",
"headers",
"=",
"{",
"}",
";",
"if",
"(",
"IS_METHOD_WITH_BODY",
".",
"test",
"(",
"requestData",
".",
"method",
")",
")",
"{",
"// when send a FormData instance, browsers serialize ... | Sets transport request headers
@private | [
"Sets",
"transport",
"request",
"headers"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/net/ajax.js#L86-L127 | train |
basisjs/basisjs | src/basis/xml.js | XML2Object | function XML2Object(node, mapping){ // require for refactoring
var nodeType = node.nodeType;
var attributes = node.attributes;
var firstChild = node.firstChild;
if (!firstChild)
{
var firstAttr = attributes && attributes[0];
if (nodeType == ELEMENT_NODE)
{
if (!firstAttr)... | javascript | function XML2Object(node, mapping){ // require for refactoring
var nodeType = node.nodeType;
var attributes = node.attributes;
var firstChild = node.firstChild;
if (!firstChild)
{
var firstAttr = attributes && attributes[0];
if (nodeType == ELEMENT_NODE)
{
if (!firstAttr)... | [
"function",
"XML2Object",
"(",
"node",
",",
"mapping",
")",
"{",
"// require for refactoring",
"var",
"nodeType",
"=",
"node",
".",
"nodeType",
";",
"var",
"attributes",
"=",
"node",
".",
"attributes",
";",
"var",
"firstChild",
"=",
"node",
".",
"firstChild",
... | XML -> Object
Converting xml tree to javascript object representation.
@function
@param {Node} node
@param {object} mapping
@return {object} | [
"XML",
"-",
">",
"Object",
"Converting",
"xml",
"tree",
"to",
"javascript",
"object",
"representation",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/xml.js#L167-L300 | train |
basisjs/basisjs | src/basis/xml.js | isPrimitiveObject | function isPrimitiveObject(value){
return typeof value == 'string' || typeof value == 'number' ||
typeof value == 'function' || typeof value == 'boolean' ||
value.constructor === Date || value.constructor === RegExp;
} | javascript | function isPrimitiveObject(value){
return typeof value == 'string' || typeof value == 'number' ||
typeof value == 'function' || typeof value == 'boolean' ||
value.constructor === Date || value.constructor === RegExp;
} | [
"function",
"isPrimitiveObject",
"(",
"value",
")",
"{",
"return",
"typeof",
"value",
"==",
"'string'",
"||",
"typeof",
"value",
"==",
"'number'",
"||",
"typeof",
"value",
"==",
"'function'",
"||",
"typeof",
"value",
"==",
"'boolean'",
"||",
"value",
".",
"c... | Object -> XML | [
"Object",
"-",
">",
"XML"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/xml.js#L306-L310 | train |
basisjs/basisjs | src/basis/xml.js | XML2String | function XML2String(node){
// modern browsers feature
if (typeof XMLSerializer != 'undefined')
return new XMLSerializer().serializeToString(node);
// old IE feature
if (typeof node.xml == 'string')
return node.xml;
// other browsers
if (node.nodeType == domUtils.DOCUMENT_NODE)
... | javascript | function XML2String(node){
// modern browsers feature
if (typeof XMLSerializer != 'undefined')
return new XMLSerializer().serializeToString(node);
// old IE feature
if (typeof node.xml == 'string')
return node.xml;
// other browsers
if (node.nodeType == domUtils.DOCUMENT_NODE)
... | [
"function",
"XML2String",
"(",
"node",
")",
"{",
"// modern browsers feature",
"if",
"(",
"typeof",
"XMLSerializer",
"!=",
"'undefined'",
")",
"return",
"new",
"XMLSerializer",
"(",
")",
".",
"serializeToString",
"(",
"node",
")",
";",
"// old IE feature",
"if",
... | XML -> string | [
"XML",
"-",
">",
"string"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/xml.js#L396-L410 | train |
basisjs/basisjs | src/basis/dom/event.js | kill | function kill(event, node){
node = getNode(node);
if (node)
addHandler(node, event, kill);
else
{
cancelDefault(event);
cancelBubble(event);
}
} | javascript | function kill(event, node){
node = getNode(node);
if (node)
addHandler(node, event, kill);
else
{
cancelDefault(event);
cancelBubble(event);
}
} | [
"function",
"kill",
"(",
"event",
",",
"node",
")",
"{",
"node",
"=",
"getNode",
"(",
"node",
")",
";",
"if",
"(",
"node",
")",
"addHandler",
"(",
"node",
",",
"event",
",",
"kill",
")",
";",
"else",
"{",
"cancelDefault",
"(",
"event",
")",
";",
... | Stops event bubbling and prevent default actions for event.
@param {Event|string} event
@param {Node=} node | [
"Stops",
"event",
"bubbling",
"and",
"prevent",
"default",
"actions",
"for",
"event",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L300-L310 | train |
basisjs/basisjs | src/basis/dom/event.js | mouseButton | function mouseButton(event, button){
if (typeof event.which == 'number')
// DOM scheme
return event.which == button.VALUE;
else
// IE6-8
return !!(event.button & button.BIT);
} | javascript | function mouseButton(event, button){
if (typeof event.which == 'number')
// DOM scheme
return event.which == button.VALUE;
else
// IE6-8
return !!(event.button & button.BIT);
} | [
"function",
"mouseButton",
"(",
"event",
",",
"button",
")",
"{",
"if",
"(",
"typeof",
"event",
".",
"which",
"==",
"'number'",
")",
"// DOM scheme",
"return",
"event",
".",
"which",
"==",
"button",
".",
"VALUE",
";",
"else",
"// IE6-8",
"return",
"!",
"... | Checks if pressed mouse button equal to desire mouse button.
@param {Event} event
@param {object} button One of MOUSE constant
@return {boolean} | [
"Checks",
"if",
"pressed",
"mouse",
"button",
"equal",
"to",
"desire",
"mouse",
"button",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L336-L343 | train |
basisjs/basisjs | src/basis/dom/event.js | mouseX | function mouseX(event){
if ('pageX' in event)
return event.pageX;
else
return 'clientX' in event
? event.clientX +
(document.compatMode == 'CSS1Compat' ? document.documentElement.scrollLeft : document.body.scrollLeft)
: 0;
} | javascript | function mouseX(event){
if ('pageX' in event)
return event.pageX;
else
return 'clientX' in event
? event.clientX +
(document.compatMode == 'CSS1Compat' ? document.documentElement.scrollLeft : document.body.scrollLeft)
: 0;
} | [
"function",
"mouseX",
"(",
"event",
")",
"{",
"if",
"(",
"'pageX'",
"in",
"event",
")",
"return",
"event",
".",
"pageX",
";",
"else",
"return",
"'clientX'",
"in",
"event",
"?",
"event",
".",
"clientX",
"+",
"(",
"document",
".",
"compatMode",
"==",
"'C... | Returns mouse click horizontal page coordinate.
@param {Event} event
@return {number} | [
"Returns",
"mouse",
"click",
"horizontal",
"page",
"coordinate",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L350-L358 | train |
basisjs/basisjs | src/basis/dom/event.js | mouseY | function mouseY(event){
if ('pageY' in event)
return event.pageY;
else
return 'clientY' in event
? event.clientY +
(document.compatMode == 'CSS1Compat' ? document.documentElement.scrollTop : document.body.scrollTop)
: 0;
} | javascript | function mouseY(event){
if ('pageY' in event)
return event.pageY;
else
return 'clientY' in event
? event.clientY +
(document.compatMode == 'CSS1Compat' ? document.documentElement.scrollTop : document.body.scrollTop)
: 0;
} | [
"function",
"mouseY",
"(",
"event",
")",
"{",
"if",
"(",
"'pageY'",
"in",
"event",
")",
"return",
"event",
".",
"pageY",
";",
"else",
"return",
"'clientY'",
"in",
"event",
"?",
"event",
".",
"clientY",
"+",
"(",
"document",
".",
"compatMode",
"==",
"'C... | Returns mouse click vertical page coordinate.
@param {Event} event
@return {number} | [
"Returns",
"mouse",
"click",
"vertical",
"page",
"coordinate",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L365-L373 | train |
basisjs/basisjs | src/basis/dom/event.js | wheelDelta | function wheelDelta(event){
var delta = 0;
if ('deltaY' in event)
delta = -event.deltaY; // safari & gecko
else
if ('wheelDelta' in event)
delta = event.wheelDelta; // IE, webkit, opera
else
if (event.type == 'DOMMouseScroll')
delta = -event.detail; // old ... | javascript | function wheelDelta(event){
var delta = 0;
if ('deltaY' in event)
delta = -event.deltaY; // safari & gecko
else
if ('wheelDelta' in event)
delta = event.wheelDelta; // IE, webkit, opera
else
if (event.type == 'DOMMouseScroll')
delta = -event.detail; // old ... | [
"function",
"wheelDelta",
"(",
"event",
")",
"{",
"var",
"delta",
"=",
"0",
";",
"if",
"(",
"'deltaY'",
"in",
"event",
")",
"delta",
"=",
"-",
"event",
".",
"deltaY",
";",
"// safari & gecko",
"else",
"if",
"(",
"'wheelDelta'",
"in",
"event",
")",
"del... | Returns mouse wheel delta.
@param {Event} event
@return {number} -1, 0, 1 | [
"Returns",
"mouse",
"wheel",
"delta",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L400-L413 | train |
basisjs/basisjs | src/basis/dom/event.js | observeGlobalEvents | function observeGlobalEvents(event){
var handlers = arrayFrom(globalHandlers[event.type]);
var captureHandler = captureHandlers[event.type];
var wrappedEvent = new Event(event);
startFrame(event);
if (captureHandler)
{
captureHandler.handler.call(captureHandler.thisObject, wrappedEvent);... | javascript | function observeGlobalEvents(event){
var handlers = arrayFrom(globalHandlers[event.type]);
var captureHandler = captureHandlers[event.type];
var wrappedEvent = new Event(event);
startFrame(event);
if (captureHandler)
{
captureHandler.handler.call(captureHandler.thisObject, wrappedEvent);... | [
"function",
"observeGlobalEvents",
"(",
"event",
")",
"{",
"var",
"handlers",
"=",
"arrayFrom",
"(",
"globalHandlers",
"[",
"event",
".",
"type",
"]",
")",
";",
"var",
"captureHandler",
"=",
"captureHandlers",
"[",
"event",
".",
"type",
"]",
";",
"var",
"w... | Observe handlers for event
@private
@param {Event} event | [
"Observe",
"handlers",
"for",
"event"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L462-L486 | train |
basisjs/basisjs | src/basis/dom/event.js | addGlobalHandler | function addGlobalHandler(eventType, handler, thisObject){
var handlers = globalHandlers[eventType];
if (handlers)
{
// search for similar handler, returns if found (prevent for handler dublicates)
for (var i = 0, item; item = handlers[i]; i++)
if (item.handler === handler && item.thisOb... | javascript | function addGlobalHandler(eventType, handler, thisObject){
var handlers = globalHandlers[eventType];
if (handlers)
{
// search for similar handler, returns if found (prevent for handler dublicates)
for (var i = 0, item; item = handlers[i]; i++)
if (item.handler === handler && item.thisOb... | [
"function",
"addGlobalHandler",
"(",
"eventType",
",",
"handler",
",",
"thisObject",
")",
"{",
"var",
"handlers",
"=",
"globalHandlers",
"[",
"eventType",
"]",
";",
"if",
"(",
"handlers",
")",
"{",
"// search for similar handler, returns if found (prevent for handler du... | Adds global handler for some event type.
@param {string} eventType
@param {function(event)} handler
@param {object=} thisObject Context for handler | [
"Adds",
"global",
"handler",
"for",
"some",
"event",
"type",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L525-L550 | train |
basisjs/basisjs | src/basis/dom/event.js | removeGlobalHandler | function removeGlobalHandler(eventType, handler, thisObject){
var handlers = globalHandlers[eventType];
if (handlers)
{
for (var i = 0, item; item = handlers[i]; i++)
{
if (item.handler === handler && item.thisObject === thisObject)
{
handlers.splice(i, 1);
i... | javascript | function removeGlobalHandler(eventType, handler, thisObject){
var handlers = globalHandlers[eventType];
if (handlers)
{
for (var i = 0, item; item = handlers[i]; i++)
{
if (item.handler === handler && item.thisObject === thisObject)
{
handlers.splice(i, 1);
i... | [
"function",
"removeGlobalHandler",
"(",
"eventType",
",",
"handler",
",",
"thisObject",
")",
"{",
"var",
"handlers",
"=",
"globalHandlers",
"[",
"eventType",
"]",
";",
"if",
"(",
"handlers",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"item",
";",
... | Removes global handler for eventType storage.
@param {string} eventType
@param {function(event)} handler
@param {object=} thisObject Context for handler | [
"Removes",
"global",
"handler",
"for",
"eventType",
"storage",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L558-L581 | train |
basisjs/basisjs | src/basis/dom/event.js | addHandler | function addHandler(node, eventType, handler, thisObject){
node = getNode(node);
if (!node)
throw 'basis.event.addHandler: can\'t attach event listener to undefined';
if (typeof handler != 'function')
throw 'basis.event.addHandler: handler is not a function';
var handlers = node === globa... | javascript | function addHandler(node, eventType, handler, thisObject){
node = getNode(node);
if (!node)
throw 'basis.event.addHandler: can\'t attach event listener to undefined';
if (typeof handler != 'function')
throw 'basis.event.addHandler: handler is not a function';
var handlers = node === globa... | [
"function",
"addHandler",
"(",
"node",
",",
"eventType",
",",
"handler",
",",
"thisObject",
")",
"{",
"node",
"=",
"getNode",
"(",
"node",
")",
";",
"if",
"(",
"!",
"node",
")",
"throw",
"'basis.event.addHandler: can\\'t attach event listener to undefined'",
";",
... | common event handlers
Adds handler for node for eventType events.
@param {Node|Window|string} node
@param {string} eventType
@param {function(event)} handler
@param {object=} thisObject Context for handler | [
"common",
"event",
"handlers",
"Adds",
"handler",
"for",
"node",
"for",
"eventType",
"events",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L594-L658 | train |
basisjs/basisjs | src/basis/dom/event.js | addHandlers | function addHandlers(node, handlers, thisObject){
node = getNode(node);
for (var eventType in handlers)
addHandler(node, eventType, handlers[eventType], thisObject);
} | javascript | function addHandlers(node, handlers, thisObject){
node = getNode(node);
for (var eventType in handlers)
addHandler(node, eventType, handlers[eventType], thisObject);
} | [
"function",
"addHandlers",
"(",
"node",
",",
"handlers",
",",
"thisObject",
")",
"{",
"node",
"=",
"getNode",
"(",
"node",
")",
";",
"for",
"(",
"var",
"eventType",
"in",
"handlers",
")",
"addHandler",
"(",
"node",
",",
"eventType",
",",
"handlers",
"[",... | Adds multiple handlers for node.
@param {Node|Window|string} node
@param {object} handlers
@param {object=} thisObject Context for handlers | [
"Adds",
"multiple",
"handlers",
"for",
"node",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L666-L671 | train |
basisjs/basisjs | src/basis/dom/event.js | removeHandler | function removeHandler(node, eventType, handler, thisObject){
node = getNode(node);
var handlers = node === global ? globalEvents : node[EVENT_HOLDER];
if (handlers)
{
var eventTypeHandlers = handlers[eventType];
if (eventTypeHandlers)
{
for (var i = 0, item; item = eventTypeH... | javascript | function removeHandler(node, eventType, handler, thisObject){
node = getNode(node);
var handlers = node === global ? globalEvents : node[EVENT_HOLDER];
if (handlers)
{
var eventTypeHandlers = handlers[eventType];
if (eventTypeHandlers)
{
for (var i = 0, item; item = eventTypeH... | [
"function",
"removeHandler",
"(",
"node",
",",
"eventType",
",",
"handler",
",",
"thisObject",
")",
"{",
"node",
"=",
"getNode",
"(",
"node",
")",
";",
"var",
"handlers",
"=",
"node",
"===",
"global",
"?",
"globalEvents",
":",
"node",
"[",
"EVENT_HOLDER",
... | Removes handler from node's handler holder.
@param {Node|Window|string} node
@param {string} eventType
@param {object} handler
@param {object=} thisObject Context for handlers | [
"Removes",
"handler",
"from",
"node",
"s",
"handler",
"holder",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L680-L705 | train |
basisjs/basisjs | src/basis/dom/event.js | clearHandlers | function clearHandlers(node, eventType){
node = getNode(node);
var handlers = node === global ? globalEvents : node[EVENT_HOLDER];
if (handlers)
{
if (typeof eventType != 'string')
{
// no eventType - delete handlers for all events
for (eventType in handlers)
clear... | javascript | function clearHandlers(node, eventType){
node = getNode(node);
var handlers = node === global ? globalEvents : node[EVENT_HOLDER];
if (handlers)
{
if (typeof eventType != 'string')
{
// no eventType - delete handlers for all events
for (eventType in handlers)
clear... | [
"function",
"clearHandlers",
"(",
"node",
",",
"eventType",
")",
"{",
"node",
"=",
"getNode",
"(",
"node",
")",
";",
"var",
"handlers",
"=",
"node",
"===",
"global",
"?",
"globalEvents",
":",
"node",
"[",
"EVENT_HOLDER",
"]",
";",
"if",
"(",
"handlers",
... | Removes all node's handlers for eventType. If eventType omited, all handlers for all eventTypes will be deleted.
@param {Node|string} node
@param {string} eventType | [
"Removes",
"all",
"node",
"s",
"handlers",
"for",
"eventType",
".",
"If",
"eventType",
"omited",
"all",
"handlers",
"for",
"all",
"eventTypes",
"will",
"be",
"deleted",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L712-L739 | train |
basisjs/basisjs | src/basis/dom/event.js | onUnload | function onUnload(handler, thisObject){
// deprecated in 1.4
/** @cut */ basis.dev.warn('basis.dom.event.onUnload() is deprecated, use basis.teardown() instead');
basis.teardown(handler, thisObject);
} | javascript | function onUnload(handler, thisObject){
// deprecated in 1.4
/** @cut */ basis.dev.warn('basis.dom.event.onUnload() is deprecated, use basis.teardown() instead');
basis.teardown(handler, thisObject);
} | [
"function",
"onUnload",
"(",
"handler",
",",
"thisObject",
")",
"{",
"// deprecated in 1.4",
"/** @cut */",
"basis",
".",
"dev",
".",
"warn",
"(",
"'basis.dom.event.onUnload() is deprecated, use basis.teardown() instead'",
")",
";",
"basis",
".",
"teardown",
"(",
"handl... | on document load event dispatcher
Attach unload handlers for page
@param {function(event)} handler
@param {object=} thisObject Context for handler | [
"on",
"document",
"load",
"event",
"dispatcher",
"Attach",
"unload",
"handlers",
"for",
"page"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/dom/event.js#L768-L772 | train |
basisjs/basisjs | src/basis/utils/highlight.js | highlight | function highlight(text, lang, options){
function makeSafe(str){
return str
.replace(/\r\n|\n\r|\r/g, '\n')
.replace(/&/g, '&')
.replace(/</g, '<');
}
function normalize(text){
text = text
// cut first empty lines
.replace(/^(?:\s*[\n]+)+?([ \t]*)... | javascript | function highlight(text, lang, options){
function makeSafe(str){
return str
.replace(/\r\n|\n\r|\r/g, '\n')
.replace(/&/g, '&')
.replace(/</g, '<');
}
function normalize(text){
text = text
// cut first empty lines
.replace(/^(?:\s*[\n]+)+?([ \t]*)... | [
"function",
"highlight",
"(",
"text",
",",
"lang",
",",
"options",
")",
"{",
"function",
"makeSafe",
"(",
"str",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"/",
"\\r\\n|\\n\\r|\\r",
"/",
"g",
",",
"'\\n'",
")",
".",
"replace",
"(",
"/",
"&",
"/"... | Function that produce html code from text.
@param {string} text
@param {string=} lang
@param {object=} options
@return {string} | [
"Function",
"that",
"produce",
"html",
"code",
"from",
"text",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/utils/highlight.js#L370-L470 | train |
basisjs/basisjs | src/basis/data.js | function(value){
var oldValue = this.value;
var newValue = this.proxy ? this.proxy(value) : value;
var changed = newValue !== oldValue;
if (changed)
{
if (this.setNullOnEmitterDestroy)
{
if (oldValue instanceof Emitter)
oldValue.removeHandler(VALUE_EM... | javascript | function(value){
var oldValue = this.value;
var newValue = this.proxy ? this.proxy(value) : value;
var changed = newValue !== oldValue;
if (changed)
{
if (this.setNullOnEmitterDestroy)
{
if (oldValue instanceof Emitter)
oldValue.removeHandler(VALUE_EM... | [
"function",
"(",
"value",
")",
"{",
"var",
"oldValue",
"=",
"this",
".",
"value",
";",
"var",
"newValue",
"=",
"this",
".",
"proxy",
"?",
"this",
".",
"proxy",
"(",
"value",
")",
":",
"value",
";",
"var",
"changed",
"=",
"newValue",
"!==",
"oldValue"... | Sets new value but only if value is not equivalent to current
property's value. Change event emit if value was changed.
@param {*} value New value for property.
@return {boolean} Returns true if value was changed. | [
"Sets",
"new",
"value",
"but",
"only",
"if",
"value",
"is",
"not",
"equivalent",
"to",
"current",
"property",
"s",
"value",
".",
"Change",
"event",
"emit",
"if",
"value",
"was",
"changed",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L257-L279 | train | |
basisjs/basisjs | src/basis/data.js | function(){
if (this.locked)
{
this.locked--;
if (!this.locked)
{
var lockedValue = this.lockedValue_;
this.lockedValue_ = null;
if (this.value !== lockedValue)
this.emit_change(lockedValue);
}
}
} | javascript | function(){
if (this.locked)
{
this.locked--;
if (!this.locked)
{
var lockedValue = this.lockedValue_;
this.lockedValue_ = null;
if (this.value !== lockedValue)
this.emit_change(lockedValue);
}
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"locked",
")",
"{",
"this",
".",
"locked",
"--",
";",
"if",
"(",
"!",
"this",
".",
"locked",
")",
"{",
"var",
"lockedValue",
"=",
"this",
".",
"lockedValue_",
";",
"this",
".",
"lockedValue_",
"=",... | Unlocks value for change event fire. If value changed during object
was locked, than change event fires. | [
"Unlocks",
"value",
"for",
"change",
"event",
"fire",
".",
"If",
"value",
"changed",
"during",
"object",
"was",
"locked",
"than",
"change",
"event",
"fires",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L310-L325 | train | |
basisjs/basisjs | src/basis/data.js | function(fn){
// obsolete in 1.4
/** @cut */ if (arguments.length > 1)
/** @cut */ basis.dev.warn('basis.data.Value#as() doesn\'t accept deferred flag as second parameter anymore. Use value.as(fn).deferred() instead.');
if (!fn || fn === $self)
return this;
if (typeof fn == 'st... | javascript | function(fn){
// obsolete in 1.4
/** @cut */ if (arguments.length > 1)
/** @cut */ basis.dev.warn('basis.data.Value#as() doesn\'t accept deferred flag as second parameter anymore. Use value.as(fn).deferred() instead.');
if (!fn || fn === $self)
return this;
if (typeof fn == 'st... | [
"function",
"(",
"fn",
")",
"{",
"// obsolete in 1.4",
"/** @cut */",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"/** @cut */",
"basis",
".",
"dev",
".",
"warn",
"(",
"'basis.data.Value#as() doesn\\'t accept deferred flag as second parameter anymore. Use value.... | Returns Value instance which value equals to transformed via fn function.
@param {function(value)} fn
@return {basis.data.Value} | [
"Returns",
"Value",
"instance",
"which",
"value",
"equals",
"to",
"transformed",
"via",
"fn",
"function",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L481-L540 | train | |
basisjs/basisjs | src/basis/data.js | isConnected | function isConnected(a, b){
while (b && b !== a && b !== b.delegate)
b = b.delegate;
return b === a;
} | javascript | function isConnected(a, b){
while (b && b !== a && b !== b.delegate)
b = b.delegate;
return b === a;
} | [
"function",
"isConnected",
"(",
"a",
",",
"b",
")",
"{",
"while",
"(",
"b",
"&&",
"b",
"!==",
"a",
"&&",
"b",
"!==",
"b",
".",
"delegate",
")",
"b",
"=",
"b",
".",
"delegate",
";",
"return",
"b",
"===",
"a",
";",
"}"
] | Returns true if object is connected to another object through delegate chain.
@param {basis.data.Object} a
@param {basis.data.Object} b
@return {boolean} Whether objects are connected. | [
"Returns",
"true",
"if",
"object",
"is",
"connected",
"to",
"another",
"object",
"through",
"delegate",
"chain",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L1139-L1144 | train |
basisjs/basisjs | src/basis/data.js | applyDelegateChanges | function applyDelegateChanges(object, oldRoot, oldTarget){
var delegate = object.delegate;
if (delegate)
{
object.root = delegate.root;
object.target = delegate.target;
object.data = delegate.data;
object.state = delegate.state;
}
// fire event if root changed
if (!isEq... | javascript | function applyDelegateChanges(object, oldRoot, oldTarget){
var delegate = object.delegate;
if (delegate)
{
object.root = delegate.root;
object.target = delegate.target;
object.data = delegate.data;
object.state = delegate.state;
}
// fire event if root changed
if (!isEq... | [
"function",
"applyDelegateChanges",
"(",
"object",
",",
"oldRoot",
",",
"oldTarget",
")",
"{",
"var",
"delegate",
"=",
"object",
".",
"delegate",
";",
"if",
"(",
"delegate",
")",
"{",
"object",
".",
"root",
"=",
"delegate",
".",
"root",
";",
"object",
".... | Apply changes for all delegate graph | [
"Apply",
"changes",
"for",
"all",
"delegate",
"graph"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L1149-L1201 | train |
basisjs/basisjs | src/basis/data.js | function(data){
if (this.delegate)
return this.root.update(data);
if (data)
{
var delta = {};
var changed = false;
for (var prop in data)
if (this.data[prop] !== data[prop])
{
changed = true;
delta[prop] = this.data[prop];
... | javascript | function(data){
if (this.delegate)
return this.root.update(data);
if (data)
{
var delta = {};
var changed = false;
for (var prop in data)
if (this.data[prop] !== data[prop])
{
changed = true;
delta[prop] = this.data[prop];
... | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"this",
".",
"delegate",
")",
"return",
"this",
".",
"root",
".",
"update",
"(",
"data",
")",
";",
"if",
"(",
"data",
")",
"{",
"var",
"delta",
"=",
"{",
"}",
";",
"var",
"changed",
"=",
"false",
";... | Handle changing object data. Fires update event only if something was changed.
@param {Object} data New values for object data holder (this.data).
@return {Object|boolean} Delta if object data (this.data) was updated or false otherwise. | [
"Handle",
"changing",
"object",
"data",
".",
"Fires",
"update",
"event",
"only",
"if",
"something",
"was",
"changed",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L1563-L1588 | train | |
basisjs/basisjs | src/basis/data.js | getDatasetDelta | function getDatasetDelta(a, b){
if (!a || !a.itemCount)
{
if (b && b.itemCount)
return {
inserted: b.getItems()
};
}
else
{
if (!b || !b.itemCount)
{
if (a.itemCount)
return {
deleted: a.getItems()
};
}
e... | javascript | function getDatasetDelta(a, b){
if (!a || !a.itemCount)
{
if (b && b.itemCount)
return {
inserted: b.getItems()
};
}
else
{
if (!b || !b.itemCount)
{
if (a.itemCount)
return {
deleted: a.getItems()
};
}
e... | [
"function",
"getDatasetDelta",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"!",
"a",
"||",
"!",
"a",
".",
"itemCount",
")",
"{",
"if",
"(",
"b",
"&&",
"b",
".",
"itemCount",
")",
"return",
"{",
"inserted",
":",
"b",
".",
"getItems",
"(",
")",
"}",... | Returns delta betwwen dataset, that could be used for event
@return {object|undefined} | [
"Returns",
"delta",
"betwwen",
"dataset",
"that",
"could",
"be",
"used",
"for",
"event"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L1741-L1780 | train |
basisjs/basisjs | src/basis/data.js | function(count){
var result = [];
if (count)
for (var objectId in this.items_)
if (result.push(this.items_[objectId]) >= count)
break;
return result;
} | javascript | function(count){
var result = [];
if (count)
for (var objectId in this.items_)
if (result.push(this.items_[objectId]) >= count)
break;
return result;
} | [
"function",
"(",
"count",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"count",
")",
"for",
"(",
"var",
"objectId",
"in",
"this",
".",
"items_",
")",
"if",
"(",
"result",
".",
"push",
"(",
"this",
".",
"items_",
"[",
"objectId",
"]",... | Returns some N items from dataset if exists.
@param {number} count Max length of resulting array.
@return {Array.<basis.data.Object>} | [
"Returns",
"some",
"N",
"items",
"from",
"dataset",
"if",
"exists",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L2072-L2081 | train | |
basisjs/basisjs | src/basis/data.js | function(fn){
var items = this.getItems();
for (var i = 0; i < items.length; i++)
fn(items[i]);
} | javascript | function(fn){
var items = this.getItems();
for (var i = 0; i < items.length; i++)
fn(items[i]);
} | [
"function",
"(",
"fn",
")",
"{",
"var",
"items",
"=",
"this",
".",
"getItems",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"items",
".",
"length",
";",
"i",
"++",
")",
"fn",
"(",
"items",
"[",
"i",
"]",
")",
";",
"}"
] | Call fn for every item in dataset.
@param {function(item)} fn | [
"Call",
"fn",
"for",
"every",
"item",
"in",
"dataset",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L2087-L2092 | train | |
basisjs/basisjs | src/basis/data.js | function(items){
var delta = this.set(items) || {};
var deleted = delta.deleted;
Dataset.setAccumulateState(true);
if (deleted)
for (var i = 0, object; object = deleted[i]; i++)
object.destroy();
Dataset.setAccumulateState(false);
return delta.inserted;
} | javascript | function(items){
var delta = this.set(items) || {};
var deleted = delta.deleted;
Dataset.setAccumulateState(true);
if (deleted)
for (var i = 0, object; object = deleted[i]; i++)
object.destroy();
Dataset.setAccumulateState(false);
return delta.inserted;
} | [
"function",
"(",
"items",
")",
"{",
"var",
"delta",
"=",
"this",
".",
"set",
"(",
"items",
")",
"||",
"{",
"}",
";",
"var",
"deleted",
"=",
"delta",
".",
"deleted",
";",
"Dataset",
".",
"setAccumulateState",
"(",
"true",
")",
";",
"if",
"(",
"delet... | Set new item set and destroy deleted items.
@param {Array.<basis.data.Object>} items
@return {Array.<basis.data.Object>|undefined} Returns array of inserted items or undefined if nothing inserted. | [
"Set",
"new",
"item",
"set",
"and",
"destroy",
"deleted",
"items",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L2323-L2334 | train | |
basisjs/basisjs | src/basis/data.js | function(){
Dataset.flushChanges(this);
var deleted = this.getItems();
var listenHandler = this.listen.item;
var delta;
if (deleted.length)
{
if (listenHandler)
for (var i = 0; i < deleted.length; i++)
deleted[i].removeHandler(listenHandler, this);
... | javascript | function(){
Dataset.flushChanges(this);
var deleted = this.getItems();
var listenHandler = this.listen.item;
var delta;
if (deleted.length)
{
if (listenHandler)
for (var i = 0; i < deleted.length; i++)
deleted[i].removeHandler(listenHandler, this);
... | [
"function",
"(",
")",
"{",
"Dataset",
".",
"flushChanges",
"(",
"this",
")",
";",
"var",
"deleted",
"=",
"this",
".",
"getItems",
"(",
")",
";",
"var",
"listenHandler",
"=",
"this",
".",
"listen",
".",
"item",
";",
"var",
"delta",
";",
"if",
"(",
"... | Removes all items from dataset. | [
"Removes",
"all",
"items",
"from",
"dataset",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/data.js#L2339-L2360 | train | |
basisjs/basisjs | src/basis/l10n.js | resolveToken | function resolveToken(path){
if (path.charAt(0) == '#')
{
// return index by absolute index
return tokenIndex[parseInt(path.substr(1), 36)];
}
else
{
var parts = path.match(/^(.+?)@(.+)$/);
if (parts)
return resolveDictionary(basis.path.resolve(parts[2])).token(parts... | javascript | function resolveToken(path){
if (path.charAt(0) == '#')
{
// return index by absolute index
return tokenIndex[parseInt(path.substr(1), 36)];
}
else
{
var parts = path.match(/^(.+?)@(.+)$/);
if (parts)
return resolveDictionary(basis.path.resolve(parts[2])).token(parts... | [
"function",
"resolveToken",
"(",
"path",
")",
"{",
"if",
"(",
"path",
".",
"charAt",
"(",
"0",
")",
"==",
"'#'",
")",
"{",
"// return index by absolute index",
"return",
"tokenIndex",
"[",
"parseInt",
"(",
"path",
".",
"substr",
"(",
"1",
")",
",",
"36",... | Returns token for path. Path also may be index reference, that used in production.
@example
basis.l10n.token('token.path@path/to/dict'); // token by name and dictionary location
basis.l10n.token('#123'); // get token by base 36 index, use in production
@name basis.l10n.token
@param {string} path
@return {basis.l10n.T... | [
"Returns",
"token",
"for",
"path",
".",
"Path",
"also",
"may",
"be",
"index",
"reference",
"that",
"used",
"in",
"production",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/l10n.js#L449-L464 | train |
basisjs/basisjs | src/basis/l10n.js | function(){
for (var tokenName in this.tokens)
{
var token = this.tokens[tokenName];
var descriptor = this.getDescriptor(tokenName) || NULL_DESCRIPTOR;
var savedType = token.getType();
token.descriptor = descriptor;
if (token.value !== descriptor.value)
{
... | javascript | function(){
for (var tokenName in this.tokens)
{
var token = this.tokens[tokenName];
var descriptor = this.getDescriptor(tokenName) || NULL_DESCRIPTOR;
var savedType = token.getType();
token.descriptor = descriptor;
if (token.value !== descriptor.value)
{
... | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"tokenName",
"in",
"this",
".",
"tokens",
")",
"{",
"var",
"token",
"=",
"this",
".",
"tokens",
"[",
"tokenName",
"]",
";",
"var",
"descriptor",
"=",
"this",
".",
"getDescriptor",
"(",
"tokenName",
")",
"... | Sync token values according to current culture and it's fallback. | [
"Sync",
"token",
"values",
"according",
"to",
"current",
"culture",
"and",
"it",
"s",
"fallback",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/l10n.js#L692-L713 | train | |
basisjs/basisjs | src/basis/l10n.js | internalResolveDictionary | function internalResolveDictionary(source, noFetch) {
var dictionary;
if (typeof source == 'string')
{
var location = source;
var extname = basis.path.extname(location);
if (extname != '.l10n')
location = location.replace(new RegExp(extname + '([#?]|$)'), '.l10n$1');
sourc... | javascript | function internalResolveDictionary(source, noFetch) {
var dictionary;
if (typeof source == 'string')
{
var location = source;
var extname = basis.path.extname(location);
if (extname != '.l10n')
location = location.replace(new RegExp(extname + '([#?]|$)'), '.l10n$1');
sourc... | [
"function",
"internalResolveDictionary",
"(",
"source",
",",
"noFetch",
")",
"{",
"var",
"dictionary",
";",
"if",
"(",
"typeof",
"source",
"==",
"'string'",
")",
"{",
"var",
"location",
"=",
"source",
";",
"var",
"extname",
"=",
"basis",
".",
"path",
".",
... | Currently for internal use only, with additional argument | [
"Currently",
"for",
"internal",
"use",
"only",
"with",
"additional",
"argument"
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/l10n.js#L823-L841 | train |
basisjs/basisjs | src/basis/l10n.js | resolveCulture | function resolveCulture(name, pluralForm){
if (name && !cultures[name])
cultures[name] = new Culture(name, pluralForm);
return cultures[name || currentCulture];
} | javascript | function resolveCulture(name, pluralForm){
if (name && !cultures[name])
cultures[name] = new Culture(name, pluralForm);
return cultures[name || currentCulture];
} | [
"function",
"resolveCulture",
"(",
"name",
",",
"pluralForm",
")",
"{",
"if",
"(",
"name",
"&&",
"!",
"cultures",
"[",
"name",
"]",
")",
"cultures",
"[",
"name",
"]",
"=",
"new",
"Culture",
"(",
"name",
",",
"pluralForm",
")",
";",
"return",
"cultures"... | Returns culture instance by name. Creates new one if not exists yet.
@param {string} name Culture name
@param {object} pluralForm
@return {basis.l10n.Culture} | [
"Returns",
"culture",
"instance",
"by",
"name",
".",
"Creates",
"new",
"one",
"if",
"not",
"exists",
"yet",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/l10n.js#L1004-L1009 | train |
basisjs/basisjs | src/basis/l10n.js | setCulture | function setCulture(culture){
if (!culture)
return;
if (currentCulture != culture)
{
if (cultureList.indexOf(culture) == -1)
{
/** @cut */ basis.dev.warn('basis.l10n.setCulture: culture `' + culture + '` not in the list, the culture doesn\'t changed');
return;
}
... | javascript | function setCulture(culture){
if (!culture)
return;
if (currentCulture != culture)
{
if (cultureList.indexOf(culture) == -1)
{
/** @cut */ basis.dev.warn('basis.l10n.setCulture: culture `' + culture + '` not in the list, the culture doesn\'t changed');
return;
}
... | [
"function",
"setCulture",
"(",
"culture",
")",
"{",
"if",
"(",
"!",
"culture",
")",
"return",
";",
"if",
"(",
"currentCulture",
"!=",
"culture",
")",
"{",
"if",
"(",
"cultureList",
".",
"indexOf",
"(",
"culture",
")",
"==",
"-",
"1",
")",
"{",
"/** @... | Set new culture.
@param {string} culture Culture name. | [
"Set",
"new",
"culture",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/l10n.js#L1028-L1047 | train |
basisjs/basisjs | src/basis/l10n.js | onCultureChange | function onCultureChange(fn, context, fire){
resolveCulture.attach(fn, context);
if (fire)
fn.call(context, currentCulture);
} | javascript | function onCultureChange(fn, context, fire){
resolveCulture.attach(fn, context);
if (fire)
fn.call(context, currentCulture);
} | [
"function",
"onCultureChange",
"(",
"fn",
",",
"context",
",",
"fire",
")",
"{",
"resolveCulture",
".",
"attach",
"(",
"fn",
",",
"context",
")",
";",
"if",
"(",
"fire",
")",
"fn",
".",
"call",
"(",
"context",
",",
"currentCulture",
")",
";",
"}"
] | Add callback on culture change.
@param {function(culture)} fn Callback
@param {context=} context Context for callback
@param {boolean=} fire If true callback will be invoked with current
culture name right after callback attachment. | [
"Add",
"callback",
"on",
"culture",
"change",
"."
] | 8571903014b207a09d45ad2d1bfba277bf21289b | https://github.com/basisjs/basisjs/blob/8571903014b207a09d45ad2d1bfba277bf21289b/src/basis/l10n.js#L1134-L1139 | train |
AltspaceVR/AltspaceSDK | dist/altspace.js | init | function init(_scene, _camera, _params) {
if (!_scene || !(_scene instanceof THREE.Scene)) {
throw new TypeError('Requires THREE.Scene argument');
}
if (!_camera || !(_camera instanceof THREE.Camera)) {
throw new TypeError('Requires THREE.Camera argument');
}
scene = _scene;
camera = _camera;
var p = _param... | javascript | function init(_scene, _camera, _params) {
if (!_scene || !(_scene instanceof THREE.Scene)) {
throw new TypeError('Requires THREE.Scene argument');
}
if (!_camera || !(_camera instanceof THREE.Camera)) {
throw new TypeError('Requires THREE.Camera argument');
}
scene = _scene;
camera = _camera;
var p = _param... | [
"function",
"init",
"(",
"_scene",
",",
"_camera",
",",
"_params",
")",
"{",
"if",
"(",
"!",
"_scene",
"||",
"!",
"(",
"_scene",
"instanceof",
"THREE",
".",
"Scene",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Requires THREE.Scene argument'",
")",
... | Initializes the cursor module
@static
@method init
@param {THREE.Scene} scene
@param {THREE.Camera} camera - Camera used for raycasting.
@param {Object} [options] - An options object
@param {THREE.WebGLRenderer} [options.renderer] - If supplied, applies cursor movement to render target
instead of entire client
@membero... | [
"Initializes",
"the",
"cursor",
"module"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/dist/altspace.js#L3443-L3459 | train |
AltspaceVR/AltspaceSDK | dist/altspace.js | Simulation | function Simulation(config)
{
if ( config === void 0 ) config = {auto: true};
this._scene = null;
this._renderer = null;
this._camera = null;
var usingAFrame = window.AFRAME && document.querySelector('a-scene');
if(usingAFrame)
{
var ascene = document.querySelector('a-scene');
this._scene = ascene.object3... | javascript | function Simulation(config)
{
if ( config === void 0 ) config = {auto: true};
this._scene = null;
this._renderer = null;
this._camera = null;
var usingAFrame = window.AFRAME && document.querySelector('a-scene');
if(usingAFrame)
{
var ascene = document.querySelector('a-scene');
this._scene = ascene.object3... | [
"function",
"Simulation",
"(",
"config",
")",
"{",
"if",
"(",
"config",
"===",
"void",
"0",
")",
"config",
"=",
"{",
"auto",
":",
"true",
"}",
";",
"this",
".",
"_scene",
"=",
"null",
";",
"this",
".",
"_renderer",
"=",
"null",
";",
"this",
".",
... | Simulation is a helper class that lets you quickly setup a three.js app with support for AltspaceVR. It creates a basic scene for you and starts the render and behavior loop.
If all of your application logic is in behaviors, you do not need to create any additional requestAnimationFrame loops.
It also automatically u... | [
"Simulation",
"is",
"a",
"helper",
"class",
"that",
"lets",
"you",
"quickly",
"setup",
"a",
"three",
".",
"js",
"app",
"with",
"support",
"for",
"AltspaceVR",
".",
"It",
"creates",
"a",
"basic",
"scene",
"for",
"you",
"and",
"starts",
"the",
"render",
"a... | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/dist/altspace.js#L3556-L3588 | train |
AltspaceVR/AltspaceSDK | dist/altspace.js | init$1 | function init$1(params){
var p = params || {};
TRACE = p.TRACE || false;
if (p.crossOrigin) { crossOrigin = p.crossOrigin; }
if (p.baseUrl) { baseUrl = p.baseUrl; }
if (baseUrl.slice(-1) !== '/') { baseUrl += '/'; }
loader = new altspace.utilities.shims.OBJMTLLoader();
loader.crossOrigin = crossOrigin;
if (TRA... | javascript | function init$1(params){
var p = params || {};
TRACE = p.TRACE || false;
if (p.crossOrigin) { crossOrigin = p.crossOrigin; }
if (p.baseUrl) { baseUrl = p.baseUrl; }
if (baseUrl.slice(-1) !== '/') { baseUrl += '/'; }
loader = new altspace.utilities.shims.OBJMTLLoader();
loader.crossOrigin = crossOrigin;
if (TRA... | [
"function",
"init$1",
"(",
"params",
")",
"{",
"var",
"p",
"=",
"params",
"||",
"{",
"}",
";",
"TRACE",
"=",
"p",
".",
"TRACE",
"||",
"false",
";",
"if",
"(",
"p",
".",
"crossOrigin",
")",
"{",
"crossOrigin",
"=",
"p",
".",
"crossOrigin",
";",
"}... | end of LoadRequest | [
"end",
"of",
"LoadRequest"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/dist/altspace.js#L3683-L3693 | train |
AltspaceVR/AltspaceSDK | dist/altspace.js | ensureInVR | function ensureInVR() {
if (inTile || !inVR) //inTile && inAltspace
{
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = "@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);.altspace-info{text-align:center;font-family:'Open Sans',sans-serif;line-height:.5}.altspace... | javascript | function ensureInVR() {
if (inTile || !inVR) //inTile && inAltspace
{
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = "@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);.altspace-info{text-align:center;font-family:'Open Sans',sans-serif;line-height:.5}.altspace... | [
"function",
"ensureInVR",
"(",
")",
"{",
"if",
"(",
"inTile",
"||",
"!",
"inVR",
")",
"//inTile && inAltspace",
"{",
"var",
"css",
"=",
"document",
".",
"createElement",
"(",
"\"style\"",
")",
";",
"css",
".",
"type",
"=",
"\"text/css\"",
";",
"css",
"."... | Will stop code exection and post a message informing the user to
open the example in VR
@method ensureInVR
@memberof module:altspace/utilities/codePen | [
"Will",
"stop",
"code",
"exection",
"and",
"post",
"a",
"message",
"informing",
"the",
"user",
"to",
"open",
"the",
"example",
"in",
"VR"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/dist/altspace.js#L3770-L3817 | train |
AltspaceVR/AltspaceSDK | dist/altspace.js | getPenId | function getPenId() {
var url = getParsedUrl();
var splitPath = url.path.split('/');
var id = splitPath[splitPath.length - 1];
return id;
} | javascript | function getPenId() {
var url = getParsedUrl();
var splitPath = url.path.split('/');
var id = splitPath[splitPath.length - 1];
return id;
} | [
"function",
"getPenId",
"(",
")",
"{",
"var",
"url",
"=",
"getParsedUrl",
"(",
")",
";",
"var",
"splitPath",
"=",
"url",
".",
"path",
".",
"split",
"(",
"'/'",
")",
";",
"var",
"id",
"=",
"splitPath",
"[",
"splitPath",
".",
"length",
"-",
"1",
"]",... | Returns the pen ID, useful for setting the sync instanceId.
@method getPenId
@return {String}
@memberof module:altspace/utilities/codePen | [
"Returns",
"the",
"pen",
"ID",
"useful",
"for",
"setting",
"the",
"sync",
"instanceId",
"."
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/dist/altspace.js#L3842-L3847 | train |
AltspaceVR/AltspaceSDK | dist/altspace.js | getAuthorId | function getAuthorId() {
var url = getParsedUrl();
var splitPath = url.path.split('/');
var isTeam = splitPath[1] == 'team';
var id = isTeam ? 'team-' + splitPath[2] : splitPath[1];
return id;
} | javascript | function getAuthorId() {
var url = getParsedUrl();
var splitPath = url.path.split('/');
var isTeam = splitPath[1] == 'team';
var id = isTeam ? 'team-' + splitPath[2] : splitPath[1];
return id;
} | [
"function",
"getAuthorId",
"(",
")",
"{",
"var",
"url",
"=",
"getParsedUrl",
"(",
")",
";",
"var",
"splitPath",
"=",
"url",
".",
"path",
".",
"split",
"(",
"'/'",
")",
";",
"var",
"isTeam",
"=",
"splitPath",
"[",
"1",
"]",
"==",
"'team'",
";",
"var... | Returns the pen author ID, useful for setting the sync authorId.
@method getAuthorId
@return {String}
@memberof module:altspace/utilities/codePen | [
"Returns",
"the",
"pen",
"author",
"ID",
"useful",
"for",
"setting",
"the",
"sync",
"authorId",
"."
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/dist/altspace.js#L3855-L3861 | train |
AltspaceVR/AltspaceSDK | dist/altspace.js | isEqual | function isEqual(a, b)
{
// objects are directly equal
if(a === b){
return true;
}
// recurse for each pair of array items
else if( Array.isArray(a) && Array.isArray(b) && a.length === b.length ){
return a.every( function (v,i) { return isEqual(a[i], b[i]); } );
}
// recurse for every key/val pair in objects... | javascript | function isEqual(a, b)
{
// objects are directly equal
if(a === b){
return true;
}
// recurse for each pair of array items
else if( Array.isArray(a) && Array.isArray(b) && a.length === b.length ){
return a.every( function (v,i) { return isEqual(a[i], b[i]); } );
}
// recurse for every key/val pair in objects... | [
"function",
"isEqual",
"(",
"a",
",",
"b",
")",
"{",
"// objects are directly equal",
"if",
"(",
"a",
"===",
"b",
")",
"{",
"return",
"true",
";",
"}",
"// recurse for each pair of array items",
"else",
"if",
"(",
"Array",
".",
"isArray",
"(",
"a",
")",
"&... | deep object comparison | [
"deep",
"object",
"comparison"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/dist/altspace.js#L5674-L5697 | train |
AltspaceVR/AltspaceSDK | examples/js/libs/ColladaLoader.js | flattenSkeleton | function flattenSkeleton(skeleton) {
var list = [];
var walk = function(parentid, node, list) {
var bone = {};
bone.name = node.sid;
bone.parent = parentid;
bone.matrix = node.matrix;
var data = [ new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3() ];
bone.matrix.decompose(data[0], da... | javascript | function flattenSkeleton(skeleton) {
var list = [];
var walk = function(parentid, node, list) {
var bone = {};
bone.name = node.sid;
bone.parent = parentid;
bone.matrix = node.matrix;
var data = [ new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3() ];
bone.matrix.decompose(data[0], da... | [
"function",
"flattenSkeleton",
"(",
"skeleton",
")",
"{",
"var",
"list",
"=",
"[",
"]",
";",
"var",
"walk",
"=",
"function",
"(",
"parentid",
",",
"node",
",",
"list",
")",
"{",
"var",
"bone",
"=",
"{",
"}",
";",
"bone",
".",
"name",
"=",
"node",
... | Walk the Collada tree and flatten the bones into a list, extract the position, quat and scale from the matrix | [
"Walk",
"the",
"Collada",
"tree",
"and",
"flatten",
"the",
"bones",
"into",
"a",
"list",
"extract",
"the",
"position",
"quat",
"and",
"scale",
"from",
"the",
"matrix"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/examples/js/libs/ColladaLoader.js#L605-L634 | train |
AltspaceVR/AltspaceSDK | examples/js/libs/ColladaLoader.js | skinToBindPose | function skinToBindPose(geometry,skeleton,skinController) {
var bones = [];
setupSkeleton( skeleton, bones, -1 );
setupSkinningMatrices( bones, skinController.skin );
var v = new THREE.Vector3();
var skinned = [];
for (var i = 0; i < geometry.vertices.length; i ++) {
skinned.push(new THREE.Vector3());... | javascript | function skinToBindPose(geometry,skeleton,skinController) {
var bones = [];
setupSkeleton( skeleton, bones, -1 );
setupSkinningMatrices( bones, skinController.skin );
var v = new THREE.Vector3();
var skinned = [];
for (var i = 0; i < geometry.vertices.length; i ++) {
skinned.push(new THREE.Vector3());... | [
"function",
"skinToBindPose",
"(",
"geometry",
",",
"skeleton",
",",
"skinController",
")",
"{",
"var",
"bones",
"=",
"[",
"]",
";",
"setupSkeleton",
"(",
"skeleton",
",",
"bones",
",",
"-",
"1",
")",
";",
"setupSkinningMatrices",
"(",
"bones",
",",
"skinC... | Move the vertices into the pose that is proper for the start of the animation | [
"Move",
"the",
"vertices",
"into",
"the",
"pose",
"that",
"is",
"proper",
"for",
"the",
"start",
"of",
"the",
"animation"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/examples/js/libs/ColladaLoader.js#L637-L683 | train |
AltspaceVR/AltspaceSDK | examples/js/libs/ColladaLoader.js | getNextKeyWith | function getNextKeyWith( keys, fullSid, ndx ) {
for ( ; ndx < keys.length; ndx ++ ) {
var key = keys[ ndx ];
if ( key.hasTarget( fullSid ) ) {
return key;
}
}
return null;
} | javascript | function getNextKeyWith( keys, fullSid, ndx ) {
for ( ; ndx < keys.length; ndx ++ ) {
var key = keys[ ndx ];
if ( key.hasTarget( fullSid ) ) {
return key;
}
}
return null;
} | [
"function",
"getNextKeyWith",
"(",
"keys",
",",
"fullSid",
",",
"ndx",
")",
"{",
"for",
"(",
";",
"ndx",
"<",
"keys",
".",
"length",
";",
"ndx",
"++",
")",
"{",
"var",
"key",
"=",
"keys",
"[",
"ndx",
"]",
";",
"if",
"(",
"key",
".",
"hasTarget",
... | Get next key with given sid | [
"Get",
"next",
"key",
"with",
"given",
"sid"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/examples/js/libs/ColladaLoader.js#L1682-L1698 | train |
AltspaceVR/AltspaceSDK | examples/js/libs/ColladaLoader.js | getPrevKeyWith | function getPrevKeyWith( keys, fullSid, ndx ) {
ndx = ndx >= 0 ? ndx : ndx + keys.length;
for ( ; ndx >= 0; ndx -- ) {
var key = keys[ ndx ];
if ( key.hasTarget( fullSid ) ) {
return key;
}
}
return null;
} | javascript | function getPrevKeyWith( keys, fullSid, ndx ) {
ndx = ndx >= 0 ? ndx : ndx + keys.length;
for ( ; ndx >= 0; ndx -- ) {
var key = keys[ ndx ];
if ( key.hasTarget( fullSid ) ) {
return key;
}
}
return null;
} | [
"function",
"getPrevKeyWith",
"(",
"keys",
",",
"fullSid",
",",
"ndx",
")",
"{",
"ndx",
"=",
"ndx",
">=",
"0",
"?",
"ndx",
":",
"ndx",
"+",
"keys",
".",
"length",
";",
"for",
"(",
";",
"ndx",
">=",
"0",
";",
"ndx",
"--",
")",
"{",
"var",
"key",... | Get previous key with given sid | [
"Get",
"previous",
"key",
"with",
"given",
"sid"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/examples/js/libs/ColladaLoader.js#L1702-L1720 | train |
AltspaceVR/AltspaceSDK | examples/js/libs/ColladaLoader.js | setUpConversion | function setUpConversion() {
if ( options.convertUpAxis !== true || colladaUp === options.upAxis ) {
upConversion = null;
} else {
switch ( colladaUp ) {
case 'X':
upConversion = options.upAxis === 'Y' ? 'XtoY' : 'XtoZ';
break;
case 'Y':
upConversion = options.upAxis === 'X' ? '... | javascript | function setUpConversion() {
if ( options.convertUpAxis !== true || colladaUp === options.upAxis ) {
upConversion = null;
} else {
switch ( colladaUp ) {
case 'X':
upConversion = options.upAxis === 'Y' ? 'XtoY' : 'XtoZ';
break;
case 'Y':
upConversion = options.upAxis === 'X' ? '... | [
"function",
"setUpConversion",
"(",
")",
"{",
"if",
"(",
"options",
".",
"convertUpAxis",
"!==",
"true",
"||",
"colladaUp",
"===",
"options",
".",
"upAxis",
")",
"{",
"upConversion",
"=",
"null",
";",
"}",
"else",
"{",
"switch",
"(",
"colladaUp",
")",
"{... | Up axis conversion | [
"Up",
"axis",
"conversion"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/examples/js/libs/ColladaLoader.js#L5263-L5292 | train |
AltspaceVR/AltspaceSDK | examples/js/libs/GLTFLoader.js | replaceTHREEShaderAttributes | function replaceTHREEShaderAttributes( shaderText, technique ) {
// Expected technique attributes
var attributes = {};
for ( var attributeId in technique.attributes ) {
var pname = technique.attributes[ attributeId ];
var param = technique.parameters[ pname ];
var atype = param.type;
var semantic ... | javascript | function replaceTHREEShaderAttributes( shaderText, technique ) {
// Expected technique attributes
var attributes = {};
for ( var attributeId in technique.attributes ) {
var pname = technique.attributes[ attributeId ];
var param = technique.parameters[ pname ];
var atype = param.type;
var semantic ... | [
"function",
"replaceTHREEShaderAttributes",
"(",
"shaderText",
",",
"technique",
")",
"{",
"// Expected technique attributes",
"var",
"attributes",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"attributeId",
"in",
"technique",
".",
"attributes",
")",
"{",
"var",
"pname"... | Three.js seems too dependent on attribute names so globally replace those in the shader code | [
"Three",
".",
"js",
"seems",
"too",
"dependent",
"on",
"attribute",
"names",
"so",
"globally",
"replace",
"those",
"in",
"the",
"shader",
"code"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/examples/js/libs/GLTFLoader.js#L654-L742 | train |
AltspaceVR/AltspaceSDK | src/utilities/behaviors/SteamVRInput.js | getController | function getController(hand, config) {
const findGamepad = (resolve, reject) => {
const gamepad = altspace.getGamepads().find((g) => g.mapping === 'steamvr' && g.hand === hand);
if (gamepad) {
if(config.logging) console.log("SteamVR input device found", gamepad);
resolve(gamepad);
} else {
if(config.log... | javascript | function getController(hand, config) {
const findGamepad = (resolve, reject) => {
const gamepad = altspace.getGamepads().find((g) => g.mapping === 'steamvr' && g.hand === hand);
if (gamepad) {
if(config.logging) console.log("SteamVR input device found", gamepad);
resolve(gamepad);
} else {
if(config.log... | [
"function",
"getController",
"(",
"hand",
",",
"config",
")",
"{",
"const",
"findGamepad",
"=",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"gamepad",
"=",
"altspace",
".",
"getGamepads",
"(",
")",
".",
"find",
"(",
"(",
"g",
")",
"=>",
"... | Returns a Promise that resovles static when a steamvr controller is found | [
"Returns",
"a",
"Promise",
"that",
"resovles",
"static",
"when",
"a",
"steamvr",
"controller",
"is",
"found"
] | 3e39b6ebeed500c98f16f4cf2b0db053ec0953cd | https://github.com/AltspaceVR/AltspaceSDK/blob/3e39b6ebeed500c98f16f4cf2b0db053ec0953cd/src/utilities/behaviors/SteamVRInput.js#L6-L19 | train |
tschaub/grunt-gh-pages | lib/git.js | spawn | function spawn(exe, args, cwd) {
const deferred = Q.defer();
const child = cp.spawn(exe, args, {cwd: cwd || process.cwd()});
const buffer = [];
child.stderr.on('data', chunk => {
buffer.push(chunk.toString());
});
child.stdout.on('data', chunk => {
deferred.notify(chunk);
});
child.on('close', c... | javascript | function spawn(exe, args, cwd) {
const deferred = Q.defer();
const child = cp.spawn(exe, args, {cwd: cwd || process.cwd()});
const buffer = [];
child.stderr.on('data', chunk => {
buffer.push(chunk.toString());
});
child.stdout.on('data', chunk => {
deferred.notify(chunk);
});
child.on('close', c... | [
"function",
"spawn",
"(",
"exe",
",",
"args",
",",
"cwd",
")",
"{",
"const",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"const",
"child",
"=",
"cp",
".",
"spawn",
"(",
"exe",
",",
"args",
",",
"{",
"cwd",
":",
"cwd",
"||",
"process",
".... | Util function for handling spawned processes as promises.
@param {string} exe Executable.
@param {Array.<string>} args Arguments.
@param {string} cwd Working directory.
@return {Promise} A promise. | [
"Util",
"function",
"for",
"handling",
"spawned",
"processes",
"as",
"promises",
"."
] | 84effda4864e87b8bfc63e418e1c8a8bf3751309 | https://github.com/tschaub/grunt-gh-pages/blob/84effda4864e87b8bfc63e418e1c8a8bf3751309/lib/git.js#L52-L71 | train |
tschaub/grunt-gh-pages | lib/util.js | makeDir | function makeDir(path, callback) {
fs.mkdir(path, err => {
if (err) {
// check if directory exists
fs.stat(path, (err2, stat) => {
if (err2 || !stat.isDirectory()) {
callback(err);
} else {
callback();
}
});
} else {
callback();
}
});
} | javascript | function makeDir(path, callback) {
fs.mkdir(path, err => {
if (err) {
// check if directory exists
fs.stat(path, (err2, stat) => {
if (err2 || !stat.isDirectory()) {
callback(err);
} else {
callback();
}
});
} else {
callback();
}
});
} | [
"function",
"makeDir",
"(",
"path",
",",
"callback",
")",
"{",
"fs",
".",
"mkdir",
"(",
"path",
",",
"err",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"// check if directory exists",
"fs",
".",
"stat",
"(",
"path",
",",
"(",
"err2",
",",
"stat",
")",
"... | Make directory, ignoring errors if directory already exists.
@param {string} path Directory path.
@param {function(Error)} callback Callback. | [
"Make",
"directory",
"ignoring",
"errors",
"if",
"directory",
"already",
"exists",
"."
] | 84effda4864e87b8bfc63e418e1c8a8bf3751309 | https://github.com/tschaub/grunt-gh-pages/blob/84effda4864e87b8bfc63e418e1c8a8bf3751309/lib/util.js#L104-L119 | train |
ProseMirror/prosemirror-history | src/history.js | mustPreserveItems | function mustPreserveItems(state) {
let plugins = state.plugins
if (cachedPreserveItemsPlugins != plugins) {
cachedPreserveItems = false
cachedPreserveItemsPlugins = plugins
for (let i = 0; i < plugins.length; i++) if (plugins[i].spec.historyPreserveItems) {
cachedPreserveItems = true
break
... | javascript | function mustPreserveItems(state) {
let plugins = state.plugins
if (cachedPreserveItemsPlugins != plugins) {
cachedPreserveItems = false
cachedPreserveItemsPlugins = plugins
for (let i = 0; i < plugins.length; i++) if (plugins[i].spec.historyPreserveItems) {
cachedPreserveItems = true
break
... | [
"function",
"mustPreserveItems",
"(",
"state",
")",
"{",
"let",
"plugins",
"=",
"state",
".",
"plugins",
"if",
"(",
"cachedPreserveItemsPlugins",
"!=",
"plugins",
")",
"{",
"cachedPreserveItems",
"=",
"false",
"cachedPreserveItemsPlugins",
"=",
"plugins",
"for",
"... | Check whether any plugin in the given state has a `historyPreserveItems` property in its spec, in which case we must preserve steps exactly as they came in, so that they can be rebased. | [
"Check",
"whether",
"any",
"plugin",
"in",
"the",
"given",
"state",
"has",
"a",
"historyPreserveItems",
"property",
"in",
"its",
"spec",
"in",
"which",
"case",
"we",
"must",
"preserve",
"steps",
"exactly",
"as",
"they",
"came",
"in",
"so",
"that",
"they",
... | e1f3590f8f9b5bf1e6925dcadb0a6c2c8e715e5f | https://github.com/ProseMirror/prosemirror-history/blob/e1f3590f8f9b5bf1e6925dcadb0a6c2c8e715e5f/src/history.js#L344-L355 | train |
wecodemore/grunt-githooks | lib/githooks.js | Hook | function Hook(hookName, taskNames, options) {
/**
* The name of the hook
* @property hookName
* @type {String}
*/
this.hookName = hookName;
/**
* The name of the tasks that should be run by the hook, space separated
* @property taskNames
* @type {String}
*/
this.taskNames = taskNames;
... | javascript | function Hook(hookName, taskNames, options) {
/**
* The name of the hook
* @property hookName
* @type {String}
*/
this.hookName = hookName;
/**
* The name of the tasks that should be run by the hook, space separated
* @property taskNames
* @type {String}
*/
this.taskNames = taskNames;
... | [
"function",
"Hook",
"(",
"hookName",
",",
"taskNames",
",",
"options",
")",
"{",
"/**\n * The name of the hook\n * @property hookName\n * @type {String}\n */",
"this",
".",
"hookName",
"=",
"hookName",
";",
"/**\n * The name of the tasks that should be run by the hook, sp... | Class to help manage a hook
@class Hook
@module githooks
@constructor | [
"Class",
"to",
"help",
"manage",
"a",
"hook"
] | 8a026d6b9529c7923e734960813d1f54315a8e47 | https://github.com/wecodemore/grunt-githooks/blob/8a026d6b9529c7923e734960813d1f54315a8e47/lib/githooks.js#L14-L40 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.