id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8,700 | assaf/zombie | src/reroute.js | enableRerouting | function enableRerouting() {
if (enabled)
return;
enabled = true;
const connect = Net.Socket.prototype.connect;
Net.Socket.prototype.connect = function(options, callback) {
const hasNormalizedArgs = Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(options).length > 0;
const isNode8 ... | javascript | function enableRerouting() {
if (enabled)
return;
enabled = true;
const connect = Net.Socket.prototype.connect;
Net.Socket.prototype.connect = function(options, callback) {
const hasNormalizedArgs = Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(options).length > 0;
const isNode8 ... | [
"function",
"enableRerouting",
"(",
")",
"{",
"if",
"(",
"enabled",
")",
"return",
";",
"enabled",
"=",
"true",
";",
"const",
"connect",
"=",
"Net",
".",
"Socket",
".",
"prototype",
".",
"connect",
";",
"Net",
".",
"Socket",
".",
"prototype",
".",
"con... | Called once to hack Socket.connect | [
"Called",
"once",
"to",
"hack",
"Socket",
".",
"connect"
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/reroute.js#L51-L70 |
8,701 | assaf/zombie | src/assert.js | assertMatch | function assertMatch(actual, expected, message) {
if (isRegExp(expected))
assert(expected.test(actual), message || `Expected "${actual}" to match "${expected}"`);
else if (typeof expected === 'function')
assert(expected(actual), message);
else
assert.deepEqual(actual, expected, message);
} | javascript | function assertMatch(actual, expected, message) {
if (isRegExp(expected))
assert(expected.test(actual), message || `Expected "${actual}" to match "${expected}"`);
else if (typeof expected === 'function')
assert(expected(actual), message);
else
assert.deepEqual(actual, expected, message);
} | [
"function",
"assertMatch",
"(",
"actual",
",",
"expected",
",",
"message",
")",
"{",
"if",
"(",
"isRegExp",
"(",
"expected",
")",
")",
"assert",
"(",
"expected",
".",
"test",
"(",
"actual",
")",
",",
"message",
"||",
"`",
"${",
"actual",
"}",
"${",
"... | Used to assert that actual matches expected value, where expected may be a function or a string. | [
"Used",
"to",
"assert",
"that",
"actual",
"matches",
"expected",
"value",
"where",
"expected",
"may",
"be",
"a",
"function",
"or",
"a",
"string",
"."
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/assert.js#L10-L17 |
8,702 | assaf/zombie | src/eventloop.js | ontick | function ontick(next) {
// No point in waiting that long
if (next >= timeoutOn) {
timeout();
return;
}
const activeWindow = eventLoop.active;
if (completionFunction && activeWindow.document.documentElement)
try {
const waitFor = Math.max(next - Date.now... | javascript | function ontick(next) {
// No point in waiting that long
if (next >= timeoutOn) {
timeout();
return;
}
const activeWindow = eventLoop.active;
if (completionFunction && activeWindow.document.documentElement)
try {
const waitFor = Math.max(next - Date.now... | [
"function",
"ontick",
"(",
"next",
")",
"{",
"// No point in waiting that long",
"if",
"(",
"next",
">=",
"timeoutOn",
")",
"{",
"timeout",
"(",
")",
";",
"return",
";",
"}",
"const",
"activeWindow",
"=",
"eventLoop",
".",
"active",
";",
"if",
"(",
"comple... | Fired after every event, decide if we want to stop waiting | [
"Fired",
"after",
"every",
"event",
"decide",
"if",
"we",
"want",
"to",
"stop",
"waiting"
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/eventloop.js#L414-L433 |
8,703 | assaf/zombie | src/eventloop.js | done | function done(error) {
global.clearTimeout(timer);
eventLoop.removeListener('tick', ontick);
eventLoop.removeListener('idle', done);
eventLoop.browser.removeListener('error', done);
--eventLoop.waiting;
try {
callback(error);
} catch (error) {
// If callback ma... | javascript | function done(error) {
global.clearTimeout(timer);
eventLoop.removeListener('tick', ontick);
eventLoop.removeListener('idle', done);
eventLoop.browser.removeListener('error', done);
--eventLoop.waiting;
try {
callback(error);
} catch (error) {
// If callback ma... | [
"function",
"done",
"(",
"error",
")",
"{",
"global",
".",
"clearTimeout",
"(",
"timer",
")",
";",
"eventLoop",
".",
"removeListener",
"(",
"'tick'",
",",
"ontick",
")",
";",
"eventLoop",
".",
"removeListener",
"(",
"'idle'",
",",
"done",
")",
";",
"even... | The wait is over ... | [
"The",
"wait",
"is",
"over",
"..."
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/eventloop.js#L436-L452 |
8,704 | assaf/zombie | Gulpfile.js | changes | function changes() {
const version = require('./package.json').version;
const changelog = File.readFileSync('CHANGELOG.md', 'utf-8');
const match = changelog.match(/^## Version (.*) .*\n([\S\s]+?)\n##/m);
assert(match, 'CHANGELOG.md missing entry: ## Version ' + version);
assert.equal(match[1], version... | javascript | function changes() {
const version = require('./package.json').version;
const changelog = File.readFileSync('CHANGELOG.md', 'utf-8');
const match = changelog.match(/^## Version (.*) .*\n([\S\s]+?)\n##/m);
assert(match, 'CHANGELOG.md missing entry: ## Version ' + version);
assert.equal(match[1], version... | [
"function",
"changes",
"(",
")",
"{",
"const",
"version",
"=",
"require",
"(",
"'./package.json'",
")",
".",
"version",
";",
"const",
"changelog",
"=",
"File",
".",
"readFileSync",
"(",
"'CHANGELOG.md'",
",",
"'utf-8'",
")",
";",
"const",
"match",
"=",
"ch... | Generate a change log summary for this release git tag uses the generated .changes file | [
"Generate",
"a",
"change",
"log",
"summary",
"for",
"this",
"release",
"git",
"tag",
"uses",
"the",
"generated",
".",
"changes",
"file"
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/Gulpfile.js#L46-L57 |
8,705 | assaf/zombie | src/fetch.js | decompressStream | function decompressStream(stream, headers) {
const transferEncoding = headers.get('Transfer-Encoding');
const contentEncoding = headers.get('Content-Encoding');
if (contentEncoding === 'deflate' || transferEncoding === 'deflate')
return stream.pipe( Zlib.createInflate() );
if (contentEncoding === 'gzip' ... | javascript | function decompressStream(stream, headers) {
const transferEncoding = headers.get('Transfer-Encoding');
const contentEncoding = headers.get('Content-Encoding');
if (contentEncoding === 'deflate' || transferEncoding === 'deflate')
return stream.pipe( Zlib.createInflate() );
if (contentEncoding === 'gzip' ... | [
"function",
"decompressStream",
"(",
"stream",
",",
"headers",
")",
"{",
"const",
"transferEncoding",
"=",
"headers",
".",
"get",
"(",
"'Transfer-Encoding'",
")",
";",
"const",
"contentEncoding",
"=",
"headers",
".",
"get",
"(",
"'Content-Encoding'",
")",
";",
... | Decompress stream based on content and transfer encoding headers. | [
"Decompress",
"stream",
"based",
"on",
"content",
"and",
"transfer",
"encoding",
"headers",
"."
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/fetch.js#L9-L17 |
8,706 | assaf/zombie | src/dom/forms.js | click | function click() {
const clickEvent = input.ownerDocument.createEvent('HTMLEvents');
clickEvent.initEvent('click', true, true);
const labelElementImpl = domSymbolTree.parent(idlUtils.implForWrapper(input));
const dispatchResult = input.dispatchEvent(clickEvent);
input._click && input._click(clickEve... | javascript | function click() {
const clickEvent = input.ownerDocument.createEvent('HTMLEvents');
clickEvent.initEvent('click', true, true);
const labelElementImpl = domSymbolTree.parent(idlUtils.implForWrapper(input));
const dispatchResult = input.dispatchEvent(clickEvent);
input._click && input._click(clickEve... | [
"function",
"click",
"(",
")",
"{",
"const",
"clickEvent",
"=",
"input",
".",
"ownerDocument",
".",
"createEvent",
"(",
"'HTMLEvents'",
")",
";",
"clickEvent",
".",
"initEvent",
"(",
"'click'",
",",
"true",
",",
"true",
")",
";",
"const",
"labelElementImpl",... | First event we fire is click event | [
"First",
"event",
"we",
"fire",
"is",
"click",
"event"
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/dom/forms.js#L182-L189 |
8,707 | assaf/zombie | src/document.js | windowLoaded | function windowLoaded(event) {
document.removeEventListener('DOMContentLoaded', windowLoaded);
// JSDom > 7.1 does not allow re-dispatching the same event, so
// a copy of the event needs to be created for the new dispatch
const windowContentLoaded = document.createEvent('HTMLEvents');
windowConten... | javascript | function windowLoaded(event) {
document.removeEventListener('DOMContentLoaded', windowLoaded);
// JSDom > 7.1 does not allow re-dispatching the same event, so
// a copy of the event needs to be created for the new dispatch
const windowContentLoaded = document.createEvent('HTMLEvents');
windowConten... | [
"function",
"windowLoaded",
"(",
"event",
")",
"{",
"document",
".",
"removeEventListener",
"(",
"'DOMContentLoaded'",
",",
"windowLoaded",
")",
";",
"// JSDom > 7.1 does not allow re-dispatching the same event, so",
"// a copy of the event needs to be created for the new dispatch",
... | JSDOM fires DCL event on document but not on window | [
"JSDOM",
"fires",
"DCL",
"event",
"on",
"document",
"but",
"not",
"on",
"window"
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/document.js#L468-L476 |
8,708 | assaf/zombie | src/document.js | createDocument | function createDocument(args) {
const { browser } = args;
const features = {
FetchExternalResources: [],
ProcessExternalResources: [],
MutationEvents: '2.0'
};
const window = new Window({
parsingMode: 'html',
contentType: 'text/html',
url: args.url,
referrer... | javascript | function createDocument(args) {
const { browser } = args;
const features = {
FetchExternalResources: [],
ProcessExternalResources: [],
MutationEvents: '2.0'
};
const window = new Window({
parsingMode: 'html',
contentType: 'text/html',
url: args.url,
referrer... | [
"function",
"createDocument",
"(",
"args",
")",
"{",
"const",
"{",
"browser",
"}",
"=",
"args",
";",
"const",
"features",
"=",
"{",
"FetchExternalResources",
":",
"[",
"]",
",",
"ProcessExternalResources",
":",
"[",
"]",
",",
"MutationEvents",
":",
"'2.0'",
... | Creates an returns a new document attached to the window. | [
"Creates",
"an",
"returns",
"a",
"new",
"document",
"attached",
"to",
"the",
"window",
"."
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/document.js#L491-L531 |
8,709 | assaf/zombie | src/document.js | parseResponse | function parseResponse({ browser, history, document, response }) {
const window = document.defaultView;
window._request = response.request;
window._response = response;
history.updateLocation(window, response._url);
const done = window._eventQueue.waitForCompletion();
response
._consume()
.... | javascript | function parseResponse({ browser, history, document, response }) {
const window = document.defaultView;
window._request = response.request;
window._response = response;
history.updateLocation(window, response._url);
const done = window._eventQueue.waitForCompletion();
response
._consume()
.... | [
"function",
"parseResponse",
"(",
"{",
"browser",
",",
"history",
",",
"document",
",",
"response",
"}",
")",
"{",
"const",
"window",
"=",
"document",
".",
"defaultView",
";",
"window",
".",
"_request",
"=",
"response",
".",
"request",
";",
"window",
".",
... | Parse HTML response and setup document | [
"Parse",
"HTML",
"response",
"and",
"setup",
"document"
] | 72e365ebd823e392ab48ccc6c19032ce7819c79f | https://github.com/assaf/zombie/blob/72e365ebd823e392ab48ccc6c19032ce7819c79f/src/document.js#L630-L692 |
8,710 | AzureAD/azure-activedirectory-library-for-nodejs | lib/xmlutil.js | expandQNames | function expandQNames(xpath) {
var namespaces = constants.XmlNamespaces;
var pathParts = xpath.split('/');
for (var i=0; i < pathParts.length; i++) {
if (pathParts[i].indexOf(':') !== -1) {
var QNameParts = pathParts[i].split(':');
if (QNameParts.length !== 2) {
throw new Error('Unable to ... | javascript | function expandQNames(xpath) {
var namespaces = constants.XmlNamespaces;
var pathParts = xpath.split('/');
for (var i=0; i < pathParts.length; i++) {
if (pathParts[i].indexOf(':') !== -1) {
var QNameParts = pathParts[i].split(':');
if (QNameParts.length !== 2) {
throw new Error('Unable to ... | [
"function",
"expandQNames",
"(",
"xpath",
")",
"{",
"var",
"namespaces",
"=",
"constants",
".",
"XmlNamespaces",
";",
"var",
"pathParts",
"=",
"xpath",
".",
"split",
"(",
"'/'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"pathParts",
... | The xpath implementation being used does not have a way of matching expanded namespace.
This method takes an xpath query and expands all of the namespaces involved. It then
re-writes the query in to a longer form that directory matches the correct namespaces.
@private
@static
@memberOf XmlUtil
@param {string} xpath ... | [
"The",
"xpath",
"implementation",
"being",
"used",
"does",
"not",
"have",
"a",
"way",
"of",
"matching",
"expanded",
"namespace",
".",
"This",
"method",
"takes",
"an",
"xpath",
"query",
"and",
"expands",
"all",
"of",
"the",
"namespaces",
"involved",
".",
"It"... | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/xmlutil.js#L45-L60 |
8,711 | AzureAD/azure-activedirectory-library-for-nodejs | lib/xmlutil.js | function(node) {
var doc = '';
var sibling = node.firstChild;
var serializer = new XMLSerializer();
while (sibling) {
if (this.isElementNode(sibling)) {
doc += serializer.serializeToString(sibling);
}
sibling = sibling.nextSibling;
}
return doc !== '' ? doc : null;
... | javascript | function(node) {
var doc = '';
var sibling = node.firstChild;
var serializer = new XMLSerializer();
while (sibling) {
if (this.isElementNode(sibling)) {
doc += serializer.serializeToString(sibling);
}
sibling = sibling.nextSibling;
}
return doc !== '' ? doc : null;
... | [
"function",
"(",
"node",
")",
"{",
"var",
"doc",
"=",
"''",
";",
"var",
"sibling",
"=",
"node",
".",
"firstChild",
";",
"var",
"serializer",
"=",
"new",
"XMLSerializer",
"(",
")",
";",
"while",
"(",
"sibling",
")",
"{",
"if",
"(",
"this",
".",
"isE... | Given a dom node serializes all immediate children that are xml elements.
@static
@memberOf XmlUtil
@param {object} node An xml dom node.
@return {string} Serialized xml. | [
"Given",
"a",
"dom",
"node",
"serializes",
"all",
"immediate",
"children",
"that",
"are",
"xml",
"elements",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/xmlutil.js#L84-L97 | |
8,712 | AzureAD/azure-activedirectory-library-for-nodejs | lib/xmlutil.js | function(node) {
var sibling = node.firstChild;
while (sibling && !sibling.data) {
sibling = sibling.nextSibling;
}
return sibling.data ? sibling.data : null;
} | javascript | function(node) {
var sibling = node.firstChild;
while (sibling && !sibling.data) {
sibling = sibling.nextSibling;
}
return sibling.data ? sibling.data : null;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"sibling",
"=",
"node",
".",
"firstChild",
";",
"while",
"(",
"sibling",
"&&",
"!",
"sibling",
".",
"data",
")",
"{",
"sibling",
"=",
"sibling",
".",
"nextSibling",
";",
"}",
"return",
"sibling",
".",
"data",
... | Given an xmldom node this function returns any text data contained within.
@static
@memberOf XmlUtil
@param {object} node An xmldom node from which the data should be extracted.
@return {string} Any data found within the element or null if none is found. | [
"Given",
"an",
"xmldom",
"node",
"this",
"function",
"returns",
"any",
"text",
"data",
"contained",
"within",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/xmlutil.js#L117-L124 | |
8,713 | AzureAD/azure-activedirectory-library-for-nodejs | lib/authority.js | Authority | function Authority(authorityUrl, validateAuthority) {
this._log = null;
this._url = url.parse(authorityUrl);
this._validateAuthorityUrl();
this._validated = !validateAuthority;
this._host = null;
this._tenant = null;
this._parseAuthority();
this._authorizationEndpoint = null;
this._tokenEndpoint = n... | javascript | function Authority(authorityUrl, validateAuthority) {
this._log = null;
this._url = url.parse(authorityUrl);
this._validateAuthorityUrl();
this._validated = !validateAuthority;
this._host = null;
this._tenant = null;
this._parseAuthority();
this._authorizationEndpoint = null;
this._tokenEndpoint = n... | [
"function",
"Authority",
"(",
"authorityUrl",
",",
"validateAuthority",
")",
"{",
"this",
".",
"_log",
"=",
"null",
";",
"this",
".",
"_url",
"=",
"url",
".",
"parse",
"(",
"authorityUrl",
")",
";",
"this",
".",
"_validateAuthorityUrl",
"(",
")",
";",
"t... | Constructs an Authority object with a specific authority URL.
@private
@constructor
@param {string} authorityUrl A URL that identifies a token authority.
@param {bool} validateAuthority Indicates whether the Authority url should be validated as an actual AAD
authority. The default is true. | [
"Constructs",
"an",
"Authority",
"object",
"with",
"a",
"specific",
"authority",
"URL",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/authority.js#L39-L53 |
8,714 | AzureAD/azure-activedirectory-library-for-nodejs | lib/log.js | function(options) {
if (!options) {
options = {};
}
if (options.log) {
if (!_.isFunction(options.log)) {
throw new Error('setLogOptions expects the log key in the options parameter to be a function');
}
} else {
// if no log function was passed set it to a default no op ... | javascript | function(options) {
if (!options) {
options = {};
}
if (options.log) {
if (!_.isFunction(options.log)) {
throw new Error('setLogOptions expects the log key in the options parameter to be a function');
}
} else {
// if no log function was passed set it to a default no op ... | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"options",
".",
"log",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isFunction",
"(",
"options",
".",
"log",
")",
")",
"{",
"thr... | Sets global logging options for ADAL.
@param {LoggingOptions} options | [
"Sets",
"global",
"logging",
"options",
"for",
"ADAL",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/log.js#L72-L100 | |
8,715 | AzureAD/azure-activedirectory-library-for-nodejs | lib/self-signed-jwt.js | SelfSignedJwt | function SelfSignedJwt(callContext, authority, clientId) {
this._log = new Logger('SelfSignedJwt', callContext._logContext);
this._callContext = callContext;
this._authority = authority;
this._tokenEndpoint = authority.tokenEndpoint;
this._clientId = clientId;
} | javascript | function SelfSignedJwt(callContext, authority, clientId) {
this._log = new Logger('SelfSignedJwt', callContext._logContext);
this._callContext = callContext;
this._authority = authority;
this._tokenEndpoint = authority.tokenEndpoint;
this._clientId = clientId;
} | [
"function",
"SelfSignedJwt",
"(",
"callContext",
",",
"authority",
",",
"clientId",
")",
"{",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'SelfSignedJwt'",
",",
"callContext",
".",
"_logContext",
")",
";",
"this",
".",
"_callContext",
"=",
"callContext",
... | Constructs a new SelfSignedJwt object.
@param {object} callContext Context specific to this token request.
@param {Authority} authority The authority to be used as the JWT audience.
@param {string} clientId The client id of the calling app. | [
"Constructs",
"a",
"new",
"SelfSignedJwt",
"object",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/self-signed-jwt.js#L47-L54 |
8,716 | AzureAD/azure-activedirectory-library-for-nodejs | lib/cache-driver.js | CacheDriver | function CacheDriver(callContext, authority, resource, clientId, cache, refreshFunction) {
this._callContext = callContext;
this._log = new Logger('CacheDriver', callContext._logContext);
this._authority = authority;
this._resource = resource;
this._clientId = clientId;
this._cache = cache || nopCache;
th... | javascript | function CacheDriver(callContext, authority, resource, clientId, cache, refreshFunction) {
this._callContext = callContext;
this._log = new Logger('CacheDriver', callContext._logContext);
this._authority = authority;
this._resource = resource;
this._clientId = clientId;
this._cache = cache || nopCache;
th... | [
"function",
"CacheDriver",
"(",
"callContext",
",",
"authority",
",",
"resource",
",",
"clientId",
",",
"cache",
",",
"refreshFunction",
")",
"{",
"this",
".",
"_callContext",
"=",
"callContext",
";",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'CacheDr... | This is the callback that is passed to all acquireToken variants below.
@callback RefreshEntryFunction
@memberOf CacheDriver
@param {object} tokenResponse A token response to refresh.
@param {string} [resource] The resource for which to obtain the token if it is different from the original token.
@param {Acq... | [
"This",
"is",
"the",
"callback",
"that",
"is",
"passed",
"to",
"all",
"acquireToken",
"variants",
"below",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/cache-driver.js#L116-L124 |
8,717 | AzureAD/azure-activedirectory-library-for-nodejs | lib/oauth2client.js | OAuth2Client | function OAuth2Client(callContext, authority) {
this._tokenEndpoint = authority.tokenEndpoint;
this._deviceCodeEndpoint = authority.deviceCodeEndpoint;
this._log = new Logger('OAuth2Client', callContext._logContext);
this._callContext = callContext;
this._cancelPollingRequest = false;
} | javascript | function OAuth2Client(callContext, authority) {
this._tokenEndpoint = authority.tokenEndpoint;
this._deviceCodeEndpoint = authority.deviceCodeEndpoint;
this._log = new Logger('OAuth2Client', callContext._logContext);
this._callContext = callContext;
this._cancelPollingRequest = false;
} | [
"function",
"OAuth2Client",
"(",
"callContext",
",",
"authority",
")",
"{",
"this",
".",
"_tokenEndpoint",
"=",
"authority",
".",
"tokenEndpoint",
";",
"this",
".",
"_deviceCodeEndpoint",
"=",
"authority",
".",
"deviceCodeEndpoint",
";",
"this",
".",
"_log",
"="... | Constructs an instances of OAuth2Client
@constructor
@private
@param {object} callContext Contains any context information that applies to the request.
@param {string|url} authority An url that points to an authority. | [
"Constructs",
"an",
"instances",
"of",
"OAuth2Client"
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/oauth2client.js#L72-L79 |
8,718 | AzureAD/azure-activedirectory-library-for-nodejs | lib/oauth2client.js | function (response, body) {
var tokenResponse;
try {
tokenResponse = self._handlePollingResponse(body);
} catch (e) {
self._log.error('Error validating get token response', e, true);
callback(null, e);
return;
}
... | javascript | function (response, body) {
var tokenResponse;
try {
tokenResponse = self._handlePollingResponse(body);
} catch (e) {
self._log.error('Error validating get token response', e, true);
callback(null, e);
return;
}
... | [
"function",
"(",
"response",
",",
"body",
")",
"{",
"var",
"tokenResponse",
";",
"try",
"{",
"tokenResponse",
"=",
"self",
".",
"_handlePollingResponse",
"(",
"body",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"self",
".",
"_log",
".",
"error",
"(",
... | success response callback | [
"success",
"response",
"callback"
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/oauth2client.js#L420-L431 | |
8,719 | AzureAD/azure-activedirectory-library-for-nodejs | lib/token-request.js | TokenRequest | function TokenRequest(callContext, authenticationContext, clientId, resource, redirectUri) {
this._log = new Logger('TokenRequest', callContext._logContext);
this._callContext = callContext;
this._authenticationContext = authenticationContext;
this._resource = resource;
this._clientId = clientId;
this._redi... | javascript | function TokenRequest(callContext, authenticationContext, clientId, resource, redirectUri) {
this._log = new Logger('TokenRequest', callContext._logContext);
this._callContext = callContext;
this._authenticationContext = authenticationContext;
this._resource = resource;
this._clientId = clientId;
this._redi... | [
"function",
"TokenRequest",
"(",
"callContext",
",",
"authenticationContext",
",",
"clientId",
",",
"resource",
",",
"redirectUri",
")",
"{",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'TokenRequest'",
",",
"callContext",
".",
"_logContext",
")",
";",
"t... | Constructs a new TokenRequest object.
@constructor
@private
@param {object} callContext Contains any context information that applies to the request.
@param {AuthenticationContext} authenticationContext
@param {string} resource
@param {string} clientId
@param {string} redirectUri | [
"Constructs",
"a",
"new",
"TokenRequest",
"object",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/token-request.js#L51-L65 |
8,720 | AzureAD/azure-activedirectory-library-for-nodejs | lib/user-realm.js | UserRealm | function UserRealm(callContext, userPrinciple, authority) {
this._log = new Logger('UserRealm', callContext._logContext);
this._callContext = callContext;
this._apiVersion = '1.0';
this._federationProtocol = null;
this._accountType = null;
this._federationMetadataUrl = null;
this._federationActiveAuthUrl ... | javascript | function UserRealm(callContext, userPrinciple, authority) {
this._log = new Logger('UserRealm', callContext._logContext);
this._callContext = callContext;
this._apiVersion = '1.0';
this._federationProtocol = null;
this._accountType = null;
this._federationMetadataUrl = null;
this._federationActiveAuthUrl ... | [
"function",
"UserRealm",
"(",
"callContext",
",",
"userPrinciple",
",",
"authority",
")",
"{",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'UserRealm'",
",",
"callContext",
".",
"_logContext",
")",
";",
"this",
".",
"_callContext",
"=",
"callContext",
"... | Create a new UserRealm object
@private
@constructor
@param {object} callContext Contains any context information that applies to the request.
@param {string} userPrinciple The username for which a realm needs to be discovered.
@param {string} authority The string url of the authority that owns the userPrinciple... | [
"Create",
"a",
"new",
"UserRealm",
"object"
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/user-realm.js#L45-L55 |
8,721 | AzureAD/azure-activedirectory-library-for-nodejs | lib/wstrust-request.js | WSTrustRequest | function WSTrustRequest(callContext, wstrustEndpointUrl, appliesTo, wstrustEndpointVersion) {
this._log = new Logger('WSTrustRequest', callContext._logContext);
this._callContext = callContext;
this._wstrustEndpointUrl = wstrustEndpointUrl;
this._appliesTo = appliesTo;
this._wstrustEndpointVersion = wstrustEn... | javascript | function WSTrustRequest(callContext, wstrustEndpointUrl, appliesTo, wstrustEndpointVersion) {
this._log = new Logger('WSTrustRequest', callContext._logContext);
this._callContext = callContext;
this._wstrustEndpointUrl = wstrustEndpointUrl;
this._appliesTo = appliesTo;
this._wstrustEndpointVersion = wstrustEn... | [
"function",
"WSTrustRequest",
"(",
"callContext",
",",
"wstrustEndpointUrl",
",",
"appliesTo",
",",
"wstrustEndpointVersion",
")",
"{",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'WSTrustRequest'",
",",
"callContext",
".",
"_logContext",
")",
";",
"this",
... | Creates a new instance of WSTrustRequest
@constructor
@private
@param {object} callContext Contains any context information that applies to the request.
@param {string} wstrustEndpointUrl An STS WS-Trust soap endpoint.
@param {string} appliesTo A URI that identifies a service for which the a toke... | [
"Creates",
"a",
"new",
"instance",
"of",
"WSTrustRequest"
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/wstrust-request.js#L42-L48 |
8,722 | AzureAD/azure-activedirectory-library-for-nodejs | lib/wstrust-request.js | _datePlusMinutes | function _datePlusMinutes(date, minutes) {
var minutesInMilliSeconds = minutes * 60 * 1000;
var epochTime = date.getTime() + minutesInMilliSeconds;
return new Date(epochTime);
} | javascript | function _datePlusMinutes(date, minutes) {
var minutesInMilliSeconds = minutes * 60 * 1000;
var epochTime = date.getTime() + minutesInMilliSeconds;
return new Date(epochTime);
} | [
"function",
"_datePlusMinutes",
"(",
"date",
",",
"minutes",
")",
"{",
"var",
"minutesInMilliSeconds",
"=",
"minutes",
"*",
"60",
"*",
"1000",
";",
"var",
"epochTime",
"=",
"date",
".",
"getTime",
"(",
")",
"+",
"minutesInMilliSeconds",
";",
"return",
"new",... | Given a Date object adds the minutes parameter and returns a new Date object.
@private
@static
@memberOf WSTrustRequest
@param {Date} date A Date object.
@param {Number} minutes The number of minutes to add to the date parameter.
@returns {Date} Returns a Date object. | [
"Given",
"a",
"Date",
"object",
"adds",
"the",
"minutes",
"parameter",
"and",
"returns",
"a",
"new",
"Date",
"object",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/wstrust-request.js#L59-L63 |
8,723 | AzureAD/azure-activedirectory-library-for-nodejs | lib/util.js | createRequestOptions | function createRequestOptions(self, options) {
var defaultOptions = {}; //{ strictSSL : true };
var mergedOptions = defaultOptions;
if (options) {
_.extend(mergedOptions, options);
}
if (self._callContext.options && self._callContext.options.http) {
_.extend(mergedOptions, self._callContext.options.ht... | javascript | function createRequestOptions(self, options) {
var defaultOptions = {}; //{ strictSSL : true };
var mergedOptions = defaultOptions;
if (options) {
_.extend(mergedOptions, options);
}
if (self._callContext.options && self._callContext.options.http) {
_.extend(mergedOptions, self._callContext.options.ht... | [
"function",
"createRequestOptions",
"(",
"self",
",",
"options",
")",
"{",
"var",
"defaultOptions",
"=",
"{",
"}",
";",
"//{ strictSSL : true };",
"var",
"mergedOptions",
"=",
"defaultOptions",
";",
"if",
"(",
"options",
")",
"{",
"_",
".",
"extend",
"(",
"m... | Central place for housing default request options. This is a place holder
for when SSL validation is implemented an all requests are subject to that
policy.
@static
@memberOf Util
@param {object} options A set of options that will be merged with teh default options
These will override any default options.
@returns {... | [
"Central",
"place",
"for",
"housing",
"default",
"request",
"options",
".",
"This",
"is",
"a",
"place",
"holder",
"for",
"when",
"SSL",
"validation",
"is",
"implemented",
"an",
"all",
"requests",
"are",
"subject",
"to",
"that",
"policy",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/util.js#L80-L92 |
8,724 | AzureAD/azure-activedirectory-library-for-nodejs | lib/wstrust-response.js | scrubRSTRLogMessage | function scrubRSTRLogMessage(RSTR) {
var scrubbedRSTR = null;
var singleLineRSTR = RSTR.replace(/(\r\n|\n|\r)/gm,'');
var matchResult = assertionRegEx.exec(singleLineRSTR);
if (null === matchResult) {
// No Assertion was matched so just return the RSTR as is.
scrubbedRSTR = singleLineRSTR;
} else {
... | javascript | function scrubRSTRLogMessage(RSTR) {
var scrubbedRSTR = null;
var singleLineRSTR = RSTR.replace(/(\r\n|\n|\r)/gm,'');
var matchResult = assertionRegEx.exec(singleLineRSTR);
if (null === matchResult) {
// No Assertion was matched so just return the RSTR as is.
scrubbedRSTR = singleLineRSTR;
} else {
... | [
"function",
"scrubRSTRLogMessage",
"(",
"RSTR",
")",
"{",
"var",
"scrubbedRSTR",
"=",
"null",
";",
"var",
"singleLineRSTR",
"=",
"RSTR",
".",
"replace",
"(",
"/",
"(\\r\\n|\\n|\\r)",
"/",
"gm",
",",
"''",
")",
";",
"var",
"matchResult",
"=",
"assertionRegEx"... | Creates a log message that contains the RSTR scrubbed of the actual SAML assertion.
@private
@return {string} A log message. | [
"Creates",
"a",
"log",
"message",
"that",
"contains",
"the",
"RSTR",
"scrubbed",
"of",
"the",
"actual",
"SAML",
"assertion",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/wstrust-response.js#L43-L60 |
8,725 | AzureAD/azure-activedirectory-library-for-nodejs | lib/wstrust-response.js | WSTrustResponse | function WSTrustResponse(callContext, response, wstrustVersion) {
this._log = new Logger('WSTrustResponse', callContext._logContext);
this._callContext = callContext;
this._response = response;
this._dom = null;
this._errorCode = null;
this._faultMessage = null;
this._tokenType = null;
this._token = nul... | javascript | function WSTrustResponse(callContext, response, wstrustVersion) {
this._log = new Logger('WSTrustResponse', callContext._logContext);
this._callContext = callContext;
this._response = response;
this._dom = null;
this._errorCode = null;
this._faultMessage = null;
this._tokenType = null;
this._token = nul... | [
"function",
"WSTrustResponse",
"(",
"callContext",
",",
"response",
",",
"wstrustVersion",
")",
"{",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'WSTrustResponse'",
",",
"callContext",
".",
"_logContext",
")",
";",
"this",
".",
"_callContext",
"=",
"callC... | Creates a new WSTrustResponse instance.
@constructor
@private
@param {object} callContext Contains any context information that applies to the request.
@param {string} response A soap response from a WS-Trust request.
@param {sting} wstrustVersion The version for the WS-Trust request. | [
"Creates",
"a",
"new",
"WSTrustResponse",
"instance",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/wstrust-response.js#L70-L82 |
8,726 | AzureAD/azure-activedirectory-library-for-nodejs | lib/code-request.js | CodeRequest | function CodeRequest(callContext, authenticationContext, clientId, resource) {
this._log = new Logger('DeviceCodeRequest', callContext._logContext);
this._callContext = callContext;
this._authenticationContext = authenticationContext;
this._resource = resource;
this._clientId = clientId;
//... | javascript | function CodeRequest(callContext, authenticationContext, clientId, resource) {
this._log = new Logger('DeviceCodeRequest', callContext._logContext);
this._callContext = callContext;
this._authenticationContext = authenticationContext;
this._resource = resource;
this._clientId = clientId;
//... | [
"function",
"CodeRequest",
"(",
"callContext",
",",
"authenticationContext",
",",
"clientId",
",",
"resource",
")",
"{",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'DeviceCodeRequest'",
",",
"callContext",
".",
"_logContext",
")",
";",
"this",
".",
"_cal... | Constructs a new CodeRequest object.
@constructor
@private
@param {object} callContext Contains any context information that applies to the request.
@param {AuthenticationContext} authenticationContext
@param {string} resource
@param {string} clientId
TODO: probably need to modify the parameter list. | [
"Constructs",
"a",
"new",
"CodeRequest",
"object",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/code-request.js#L43-L53 |
8,727 | AzureAD/azure-activedirectory-library-for-nodejs | lib/mex.js | Mex | function Mex(callContext, url) {
this._log = new Logger('MEX', callContext._logContext);
this._callContext = callContext;
this._url = url;
this._dom = null;
this._mexDoc = null;
this._usernamePasswordPolicy = {};
this._log.verbose('Mex created');
this._log.verbose('Mex created with url: ' + url, true);
... | javascript | function Mex(callContext, url) {
this._log = new Logger('MEX', callContext._logContext);
this._callContext = callContext;
this._url = url;
this._dom = null;
this._mexDoc = null;
this._usernamePasswordPolicy = {};
this._log.verbose('Mex created');
this._log.verbose('Mex created with url: ' + url, true);
... | [
"function",
"Mex",
"(",
"callContext",
",",
"url",
")",
"{",
"this",
".",
"_log",
"=",
"new",
"Logger",
"(",
"'MEX'",
",",
"callContext",
".",
"_logContext",
")",
";",
"this",
".",
"_callContext",
"=",
"callContext",
";",
"this",
".",
"_url",
"=",
"url... | Create a new Mex object.
@private
@constructor
@param {object} callContext Contains any context information that applies to the request.
@param {string} url The url of the mex endpoint. | [
"Create",
"a",
"new",
"Mex",
"object",
"."
] | 89ccef01b565d9f56a6f702f835aa2f9d1230aaf | https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/89ccef01b565d9f56a6f702f835aa2f9d1230aaf/lib/mex.js#L43-L52 |
8,728 | stomp-js/stompjs | spec/unit/frame.spec.js | function(data, escapeHeaderValues) {
const onFrame = jasmine.createSpy('onFrame');
const onIncomingPing = jasmine.createSpy('onIncomingPing');
const parser = new StompJs.Parser(onFrame, onIncomingPing);
parser.parseChunk(data);
const rawFrame = onFrame.calls.first().args[0];
return StompJs.Fra... | javascript | function(data, escapeHeaderValues) {
const onFrame = jasmine.createSpy('onFrame');
const onIncomingPing = jasmine.createSpy('onIncomingPing');
const parser = new StompJs.Parser(onFrame, onIncomingPing);
parser.parseChunk(data);
const rawFrame = onFrame.calls.first().args[0];
return StompJs.Fra... | [
"function",
"(",
"data",
",",
"escapeHeaderValues",
")",
"{",
"const",
"onFrame",
"=",
"jasmine",
".",
"createSpy",
"(",
"'onFrame'",
")",
";",
"const",
"onIncomingPing",
"=",
"jasmine",
".",
"createSpy",
"(",
"'onIncomingPing'",
")",
";",
"const",
"parser",
... | un-marshall a data chunk, for ease of matching body is converted to string | [
"un",
"-",
"marshall",
"a",
"data",
"chunk",
"for",
"ease",
"of",
"matching",
"body",
"is",
"converted",
"to",
"string"
] | f11ad889211b9a8bd5c90d7309a23b832e1b60af | https://github.com/stomp-js/stompjs/blob/f11ad889211b9a8bd5c90d7309a23b832e1b60af/spec/unit/frame.spec.js#L4-L13 | |
8,729 | eBay/ebayui-core | src/components/ebay-dialog/index.js | trap | function trap(opts) {
const { isTrapped: wasTrapped, restoreTrap } = this;
const isTrapped = this.isTrapped = this.state.open;
const isFirstRender = (opts && opts.firstRender);
const wasToggled = isTrapped !== wasTrapped;
const focusEl = (this.state.focus && document.getElementById(this.state.focus)... | javascript | function trap(opts) {
const { isTrapped: wasTrapped, restoreTrap } = this;
const isTrapped = this.isTrapped = this.state.open;
const isFirstRender = (opts && opts.firstRender);
const wasToggled = isTrapped !== wasTrapped;
const focusEl = (this.state.focus && document.getElementById(this.state.focus)... | [
"function",
"trap",
"(",
"opts",
")",
"{",
"const",
"{",
"isTrapped",
":",
"wasTrapped",
",",
"restoreTrap",
"}",
"=",
"this",
";",
"const",
"isTrapped",
"=",
"this",
".",
"isTrapped",
"=",
"this",
".",
"state",
".",
"open",
";",
"const",
"isFirstRender"... | Ensures that if a component is supposed to be trapped that this is
trapped after rendering. | [
"Ensures",
"that",
"if",
"a",
"component",
"is",
"supposed",
"to",
"be",
"trapped",
"that",
"this",
"is",
"trapped",
"after",
"rendering",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-dialog/index.js#L76-L138 |
8,730 | eBay/ebayui-core | src/components/ebay-dialog/index.js | release | function release() {
if (this.isTrapped) {
this.restoreTrap = this.state.open;
screenReaderTrap.untrap(this.windowEl);
keyboardTrap.untrap(this.windowEl);
} else {
this.restoreTrap = false;
}
} | javascript | function release() {
if (this.isTrapped) {
this.restoreTrap = this.state.open;
screenReaderTrap.untrap(this.windowEl);
keyboardTrap.untrap(this.windowEl);
} else {
this.restoreTrap = false;
}
} | [
"function",
"release",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isTrapped",
")",
"{",
"this",
".",
"restoreTrap",
"=",
"this",
".",
"state",
".",
"open",
";",
"screenReaderTrap",
".",
"untrap",
"(",
"this",
".",
"windowEl",
")",
";",
"keyboardTrap",
"."... | Releases the trap before each render and on destroy so
that Marko can update normally without the inserted dom nodes. | [
"Releases",
"the",
"trap",
"before",
"each",
"render",
"and",
"on",
"destroy",
"so",
"that",
"Marko",
"can",
"update",
"normally",
"without",
"the",
"inserted",
"dom",
"nodes",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-dialog/index.js#L144-L152 |
8,731 | eBay/ebayui-core | src/components/ebay-pagination/index.js | handlePageClick | function handlePageClick(originalEvent) {
const target = originalEvent.target;
emitAndFire(this, 'pagination-select', {
originalEvent,
el: target,
value: target.innerText
});
} | javascript | function handlePageClick(originalEvent) {
const target = originalEvent.target;
emitAndFire(this, 'pagination-select', {
originalEvent,
el: target,
value: target.innerText
});
} | [
"function",
"handlePageClick",
"(",
"originalEvent",
")",
"{",
"const",
"target",
"=",
"originalEvent",
".",
"target",
";",
"emitAndFire",
"(",
"this",
",",
"'pagination-select'",
",",
"{",
"originalEvent",
",",
"el",
":",
"target",
",",
"value",
":",
"target"... | Handle normal mouse click for item, next page and previous page respectively.
@param {MouseEvent} event | [
"Handle",
"normal",
"mouse",
"click",
"for",
"item",
"next",
"page",
"and",
"previous",
"page",
"respectively",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-pagination/index.js#L144-L151 |
8,732 | eBay/ebayui-core | src/common/transition/index.js | cancel | function cancel() {
if (ended) {
return;
}
ended = true;
for (let i = ran; i < pending; i++) {
const child = waitFor[i];
child.removeEventListener(TRANSITION_END, listener);
}
if (cancelFrame) {
cancelFrame();
... | javascript | function cancel() {
if (ended) {
return;
}
ended = true;
for (let i = ran; i < pending; i++) {
const child = waitFor[i];
child.removeEventListener(TRANSITION_END, listener);
}
if (cancelFrame) {
cancelFrame();
... | [
"function",
"cancel",
"(",
")",
"{",
"if",
"(",
"ended",
")",
"{",
"return",
";",
"}",
"ended",
"=",
"true",
";",
"for",
"(",
"let",
"i",
"=",
"ran",
";",
"i",
"<",
"pending",
";",
"i",
"++",
")",
"{",
"const",
"child",
"=",
"waitFor",
"[",
"... | Cancels the current transition and resets the className. | [
"Cancels",
"the",
"current",
"transition",
"and",
"resets",
"the",
"className",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/transition/index.js#L49-L67 |
8,733 | eBay/ebayui-core | src/common/transition/index.js | listener | function listener({ target }) {
target.removeEventListener(TRANSITION_END, listener);
if (++ran === pending) {
ended = true;
classList.remove(className);
if (cb) {
cb();
}
}
} | javascript | function listener({ target }) {
target.removeEventListener(TRANSITION_END, listener);
if (++ran === pending) {
ended = true;
classList.remove(className);
if (cb) {
cb();
}
}
} | [
"function",
"listener",
"(",
"{",
"target",
"}",
")",
"{",
"target",
".",
"removeEventListener",
"(",
"TRANSITION_END",
",",
"listener",
")",
";",
"if",
"(",
"++",
"ran",
"===",
"pending",
")",
"{",
"ended",
"=",
"true",
";",
"classList",
".",
"remove",
... | Handles a single transition end event.
Once all child transitions have ended the overall animation is completed. | [
"Handles",
"a",
"single",
"transition",
"end",
"event",
".",
"Once",
"all",
"child",
"transitions",
"have",
"ended",
"the",
"overall",
"animation",
"is",
"completed",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/transition/index.js#L73-L84 |
8,734 | eBay/ebayui-core | src/common/transition/index.js | nextFrame | function nextFrame(fn) {
let frame;
let cancelFrame;
if (window.requestAnimationFrame) {
frame = requestAnimationFrame(() => {
frame = requestAnimationFrame(fn);
});
cancelFrame = cancelAnimationFrame;
} else {
frame = setTimeout(fn, 26); // 16ms to simulate ... | javascript | function nextFrame(fn) {
let frame;
let cancelFrame;
if (window.requestAnimationFrame) {
frame = requestAnimationFrame(() => {
frame = requestAnimationFrame(fn);
});
cancelFrame = cancelAnimationFrame;
} else {
frame = setTimeout(fn, 26); // 16ms to simulate ... | [
"function",
"nextFrame",
"(",
"fn",
")",
"{",
"let",
"frame",
";",
"let",
"cancelFrame",
";",
"if",
"(",
"window",
".",
"requestAnimationFrame",
")",
"{",
"frame",
"=",
"requestAnimationFrame",
"(",
"(",
")",
"=>",
"{",
"frame",
"=",
"requestAnimationFrame",... | Runs a function during the next animation frame.
@param {function} fn a function to run on the next animation frame.
@return {function} a function to cancel the callback. | [
"Runs",
"a",
"function",
"during",
"the",
"next",
"animation",
"frame",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/transition/index.js#L93-L113 |
8,735 | eBay/ebayui-core | src/common/html-attributes/index.js | processHtmlAttributes | function processHtmlAttributes(input = {}) {
const attributes = {};
const htmlAttributes = input.htmlAttributes;
const wildcardAttributes = input['*'];
let obj = htmlAttributes || wildcardAttributes;
if (htmlAttributes && wildcardAttributes) {
obj = Object.assign(wildcardAttributes, htmlAtt... | javascript | function processHtmlAttributes(input = {}) {
const attributes = {};
const htmlAttributes = input.htmlAttributes;
const wildcardAttributes = input['*'];
let obj = htmlAttributes || wildcardAttributes;
if (htmlAttributes && wildcardAttributes) {
obj = Object.assign(wildcardAttributes, htmlAtt... | [
"function",
"processHtmlAttributes",
"(",
"input",
"=",
"{",
"}",
")",
"{",
"const",
"attributes",
"=",
"{",
"}",
";",
"const",
"htmlAttributes",
"=",
"input",
".",
"htmlAttributes",
";",
"const",
"wildcardAttributes",
"=",
"input",
"[",
"'*'",
"]",
";",
"... | Create object of HTML attributes for pass-through to the DOM
@param {Object} input | [
"Create",
"object",
"of",
"HTML",
"attributes",
"for",
"pass",
"-",
"through",
"to",
"the",
"DOM"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/html-attributes/index.js#L14-L31 |
8,736 | eBay/ebayui-core | src/common/emit-and-fire/index.js | emitAndFire | function emitAndFire(widget, eventName, eventArg) {
const originalEmit = widget.emit;
let event;
if ('CustomEvent' in window && typeof window.CustomEvent === 'function') {
event = new CustomEvent(eventName, { detail: eventArg });
} else {
event = document.createEvent('CustomEvent');
... | javascript | function emitAndFire(widget, eventName, eventArg) {
const originalEmit = widget.emit;
let event;
if ('CustomEvent' in window && typeof window.CustomEvent === 'function') {
event = new CustomEvent(eventName, { detail: eventArg });
} else {
event = document.createEvent('CustomEvent');
... | [
"function",
"emitAndFire",
"(",
"widget",
",",
"eventName",
",",
"eventArg",
")",
"{",
"const",
"originalEmit",
"=",
"widget",
".",
"emit",
";",
"let",
"event",
";",
"if",
"(",
"'CustomEvent'",
"in",
"window",
"&&",
"typeof",
"window",
".",
"CustomEvent",
... | Emit marko event and fire custom event on the root element
@param {Object} widget
@param {String} eventName
@param {Object} eventArg | [
"Emit",
"marko",
"event",
"and",
"fire",
"custom",
"event",
"on",
"the",
"root",
"element"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/emit-and-fire/index.js#L7-L18 |
8,737 | eBay/ebayui-core | src/components/ebay-tab/index.js | processStateChange | function processStateChange(index) {
if (index >= 0 && index < this.state.headings.length && index !== this.state.index) {
this.setState('index', index);
emitAndFire(this, 'tab-select', { index });
}
} | javascript | function processStateChange(index) {
if (index >= 0 && index < this.state.headings.length && index !== this.state.index) {
this.setState('index', index);
emitAndFire(this, 'tab-select', { index });
}
} | [
"function",
"processStateChange",
"(",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"this",
".",
"state",
".",
"headings",
".",
"length",
"&&",
"index",
"!==",
"this",
".",
"state",
".",
"index",
")",
"{",
"this",
".",
"setSt... | Common processing of index change via both UI and API
@param {Number} index | [
"Common",
"processing",
"of",
"index",
"change",
"via",
"both",
"UI",
"and",
"API"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-tab/index.js#L56-L61 |
8,738 | eBay/ebayui-core | src/components/ebay-tab/index.js | getHeadingEl | function getHeadingEl(e, isFake) {
let headingEl = e.target;
const headingClass = prefix(isFake, 'tabs__item');
while (!headingEl.classList.contains(headingClass)) {
headingEl = headingEl.parentNode;
}
return headingEl;
} | javascript | function getHeadingEl(e, isFake) {
let headingEl = e.target;
const headingClass = prefix(isFake, 'tabs__item');
while (!headingEl.classList.contains(headingClass)) {
headingEl = headingEl.parentNode;
}
return headingEl;
} | [
"function",
"getHeadingEl",
"(",
"e",
",",
"isFake",
")",
"{",
"let",
"headingEl",
"=",
"e",
".",
"target",
";",
"const",
"headingClass",
"=",
"prefix",
"(",
"isFake",
",",
"'tabs__item'",
")",
";",
"while",
"(",
"!",
"headingEl",
".",
"classList",
".",
... | Get heading element from event
@param {Event} e
@param {Boolean} isFake - If the tabs are fake | [
"Get",
"heading",
"element",
"from",
"event"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-tab/index.js#L76-L83 |
8,739 | eBay/ebayui-core | src/components/ebay-tab/index.js | getElementIndex | function getElementIndex(headingEl) {
return Array.prototype.slice.call(headingEl.parentNode.children).indexOf(headingEl);
} | javascript | function getElementIndex(headingEl) {
return Array.prototype.slice.call(headingEl.parentNode.children).indexOf(headingEl);
} | [
"function",
"getElementIndex",
"(",
"headingEl",
")",
"{",
"return",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"headingEl",
".",
"parentNode",
".",
"children",
")",
".",
"indexOf",
"(",
"headingEl",
")",
";",
"}"
] | Get 0-based index of element within its parent
@param {HTMLElement} headingEl | [
"Get",
"0",
"-",
"based",
"index",
"of",
"element",
"within",
"its",
"parent"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-tab/index.js#L89-L91 |
8,740 | eBay/ebayui-core | src/components/ebay-menu/index.js | handleItemClick | function handleItemClick(e) {
let itemEl = e.target;
const parentEl = itemEl.closest('.menu__item, .fake-menu__item');
if (parentEl) { // nested click inside menu_item
itemEl = parentEl;
}
this.setCheckedItem(getItemElementIndex(itemEl), true);
} | javascript | function handleItemClick(e) {
let itemEl = e.target;
const parentEl = itemEl.closest('.menu__item, .fake-menu__item');
if (parentEl) { // nested click inside menu_item
itemEl = parentEl;
}
this.setCheckedItem(getItemElementIndex(itemEl), true);
} | [
"function",
"handleItemClick",
"(",
"e",
")",
"{",
"let",
"itemEl",
"=",
"e",
".",
"target",
";",
"const",
"parentEl",
"=",
"itemEl",
".",
"closest",
"(",
"'.menu__item, .fake-menu__item'",
")",
";",
"if",
"(",
"parentEl",
")",
"{",
"// nested click inside men... | Handle normal mouse click for item
@param {MouseEvent} e | [
"Handle",
"normal",
"mouse",
"click",
"for",
"item"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-menu/index.js#L246-L255 |
8,741 | eBay/ebayui-core | src/components/ebay-menu/index.js | setCheckedItem | function setCheckedItem(itemIndex, toggle) {
const item = this.state.items[itemIndex];
if (item) {
if (this.state.isCheckbox && !toggle) {
item.checked = true;
} else if (this.state.isCheckbox && toggle) {
item.checked = !item.checked;
} else if (this.state.isRad... | javascript | function setCheckedItem(itemIndex, toggle) {
const item = this.state.items[itemIndex];
if (item) {
if (this.state.isCheckbox && !toggle) {
item.checked = true;
} else if (this.state.isCheckbox && toggle) {
item.checked = !item.checked;
} else if (this.state.isRad... | [
"function",
"setCheckedItem",
"(",
"itemIndex",
",",
"toggle",
")",
"{",
"const",
"item",
"=",
"this",
".",
"state",
".",
"items",
"[",
"itemIndex",
"]",
";",
"if",
"(",
"item",
")",
"{",
"if",
"(",
"this",
".",
"state",
".",
"isCheckbox",
"&&",
"!",... | Set the checked item based on the index
@param {Integer} itemIndex
@param {Boolean} toggle | [
"Set",
"the",
"checked",
"item",
"based",
"on",
"the",
"index"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-menu/index.js#L262-L282 |
8,742 | eBay/ebayui-core | src/components/ebay-menu/index.js | setCheckedList | function setCheckedList(indexArray) {
if (indexArray) {
this.state.items.forEach((item) => {
item.checked = false;
});
indexArray.forEach((index) => {
this.setCheckedItem(index);
});
this.processAfterStateChange(indexArray);
}
} | javascript | function setCheckedList(indexArray) {
if (indexArray) {
this.state.items.forEach((item) => {
item.checked = false;
});
indexArray.forEach((index) => {
this.setCheckedItem(index);
});
this.processAfterStateChange(indexArray);
}
} | [
"function",
"setCheckedList",
"(",
"indexArray",
")",
"{",
"if",
"(",
"indexArray",
")",
"{",
"this",
".",
"state",
".",
"items",
".",
"forEach",
"(",
"(",
"item",
")",
"=>",
"{",
"item",
".",
"checked",
"=",
"false",
";",
"}",
")",
";",
"indexArray"... | Set the list of options by their index
@param {Array} indexArray | [
"Set",
"the",
"list",
"of",
"options",
"by",
"their",
"index"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-menu/index.js#L353-L365 |
8,743 | eBay/ebayui-core | src/common/transformers/ebayui-attribute/index.js | transform | function transform(el, context) {
// Only runs on top level ebay ui templates (skips demos).
const isEbayUIComponentFile = COMPONENT_FILES.indexOf(context.filename) !== -1;
if (isEbayUIComponentFile && el.hasAttribute('w-bind')) {
el.setAttributeValue('data-ebayui', context.builder.literal(true));
... | javascript | function transform(el, context) {
// Only runs on top level ebay ui templates (skips demos).
const isEbayUIComponentFile = COMPONENT_FILES.indexOf(context.filename) !== -1;
if (isEbayUIComponentFile && el.hasAttribute('w-bind')) {
el.setAttributeValue('data-ebayui', context.builder.literal(true));
... | [
"function",
"transform",
"(",
"el",
",",
"context",
")",
"{",
"// Only runs on top level ebay ui templates (skips demos).",
"const",
"isEbayUIComponentFile",
"=",
"COMPONENT_FILES",
".",
"indexOf",
"(",
"context",
".",
"filename",
")",
"!==",
"-",
"1",
";",
"if",
"(... | Transform to add the `data-ebayui` attribute to top level elements for all components.
@param {Object} el
@param {Object} context | [
"Transform",
"to",
"add",
"the",
"data",
"-",
"ebayui",
"attribute",
"to",
"top",
"level",
"elements",
"for",
"all",
"components",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/transformers/ebayui-attribute/index.js#L14-L21 |
8,744 | eBay/ebayui-core | src/components/ebay-carousel/index.js | handleMove | function handleMove(originalEvent, target) {
if (this.isMoving) {
return;
}
const { state } = this;
const direction = parseInt(target.getAttribute('data-direction'), 10);
const nextIndex = this.move(direction);
const slide = getSlide(state, nextIndex);
emitAndFire(this, 'carousel-sli... | javascript | function handleMove(originalEvent, target) {
if (this.isMoving) {
return;
}
const { state } = this;
const direction = parseInt(target.getAttribute('data-direction'), 10);
const nextIndex = this.move(direction);
const slide = getSlide(state, nextIndex);
emitAndFire(this, 'carousel-sli... | [
"function",
"handleMove",
"(",
"originalEvent",
",",
"target",
")",
"{",
"if",
"(",
"this",
".",
"isMoving",
")",
"{",
"return",
";",
"}",
"const",
"{",
"state",
"}",
"=",
"this",
";",
"const",
"direction",
"=",
"parseInt",
"(",
"target",
".",
"getAttr... | Moves the carousel in the `data-direction` of the clicked element if possible.
@param {MouseEvent} originalEvent
@param {HTMLElement} target | [
"Moves",
"the",
"carousel",
"in",
"the",
"data",
"-",
"direction",
"of",
"the",
"clicked",
"element",
"if",
"possible",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L263-L273 |
8,745 | eBay/ebayui-core | src/components/ebay-carousel/index.js | handleDotClick | function handleDotClick(originalEvent, target) {
if (this.isMoving) {
return;
}
const { state: { config, itemsPerSlide } } = this;
const slide = parseInt(target.getAttribute('data-slide'), 10);
config.preserveItems = true;
this.setState('index', slide * itemsPerSlide);
emitAndFire(th... | javascript | function handleDotClick(originalEvent, target) {
if (this.isMoving) {
return;
}
const { state: { config, itemsPerSlide } } = this;
const slide = parseInt(target.getAttribute('data-slide'), 10);
config.preserveItems = true;
this.setState('index', slide * itemsPerSlide);
emitAndFire(th... | [
"function",
"handleDotClick",
"(",
"originalEvent",
",",
"target",
")",
"{",
"if",
"(",
"this",
".",
"isMoving",
")",
"{",
"return",
";",
"}",
"const",
"{",
"state",
":",
"{",
"config",
",",
"itemsPerSlide",
"}",
"}",
"=",
"this",
";",
"const",
"slide"... | Moves the carousel to the slide at `data-slide` for the clicked element if possible.
@param {MouseEvent} originalEvent
@param {HTMLElement} target | [
"Moves",
"the",
"carousel",
"to",
"the",
"slide",
"at",
"data",
"-",
"slide",
"for",
"the",
"clicked",
"element",
"if",
"possible",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L281-L290 |
8,746 | eBay/ebayui-core | src/components/ebay-carousel/index.js | togglePlay | function togglePlay(originalEvent) {
const { state: { config, paused } } = this;
config.preserveItems = true;
this.setState('paused', !paused);
if (paused && !this.isMoving) {
this.move(RIGHT);
}
emitAndFire(this, `carousel-${paused ? 'play' : 'pause'}`, { originalEvent });
} | javascript | function togglePlay(originalEvent) {
const { state: { config, paused } } = this;
config.preserveItems = true;
this.setState('paused', !paused);
if (paused && !this.isMoving) {
this.move(RIGHT);
}
emitAndFire(this, `carousel-${paused ? 'play' : 'pause'}`, { originalEvent });
} | [
"function",
"togglePlay",
"(",
"originalEvent",
")",
"{",
"const",
"{",
"state",
":",
"{",
"config",
",",
"paused",
"}",
"}",
"=",
"this",
";",
"config",
".",
"preserveItems",
"=",
"true",
";",
"this",
".",
"setState",
"(",
"'paused'",
",",
"!",
"pause... | Toggles the play state of an autoplay carousel.
@param {MouseEvent} originalEvent | [
"Toggles",
"the",
"play",
"state",
"of",
"an",
"autoplay",
"carousel",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L297-L305 |
8,747 | eBay/ebayui-core | src/components/ebay-carousel/index.js | handleScroll | function handleScroll(scrollLeft) {
const { state } = this;
const { config, items, gap } = state;
let closest;
if (scrollLeft >= getMaxOffset(state) - gap) {
closest = items.length - 1;
} else {
// Find the closest item using a binary search on each carousel slide.
const ite... | javascript | function handleScroll(scrollLeft) {
const { state } = this;
const { config, items, gap } = state;
let closest;
if (scrollLeft >= getMaxOffset(state) - gap) {
closest = items.length - 1;
} else {
// Find the closest item using a binary search on each carousel slide.
const ite... | [
"function",
"handleScroll",
"(",
"scrollLeft",
")",
"{",
"const",
"{",
"state",
"}",
"=",
"this",
";",
"const",
"{",
"config",
",",
"items",
",",
"gap",
"}",
"=",
"state",
";",
"let",
"closest",
";",
"if",
"(",
"scrollLeft",
">=",
"getMaxOffset",
"(",
... | Find the closest item index to the scroll offset and triggers an update.
@param {number} scrollLeft The current scroll position of the carousel. | [
"Find",
"the",
"closest",
"item",
"index",
"to",
"the",
"scroll",
"offset",
"and",
"triggers",
"an",
"update",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L312-L346 |
8,748 | eBay/ebayui-core | src/components/ebay-carousel/index.js | move | function move(delta) {
const { state } = this;
const { index, items, itemsPerSlide, autoplayInterval, slideWidth, gap, peek, config } = state;
const nextIndex = getNextIndex(state, delta);
let offsetOverride;
config.preserveItems = true;
this.isMoving = true;
// When we are in autoplay mod... | javascript | function move(delta) {
const { state } = this;
const { index, items, itemsPerSlide, autoplayInterval, slideWidth, gap, peek, config } = state;
const nextIndex = getNextIndex(state, delta);
let offsetOverride;
config.preserveItems = true;
this.isMoving = true;
// When we are in autoplay mod... | [
"function",
"move",
"(",
"delta",
")",
"{",
"const",
"{",
"state",
"}",
"=",
"this",
";",
"const",
"{",
"index",
",",
"items",
",",
"itemsPerSlide",
",",
"autoplayInterval",
",",
"slideWidth",
",",
"gap",
",",
"peek",
",",
"config",
"}",
"=",
"state",
... | Causes the carousel to move to the provided index.
@param {-1|1} delta 1 for right and -1 for left.
@return {number} the updated index. | [
"Causes",
"the",
"carousel",
"to",
"move",
"to",
"the",
"provided",
"index",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L354-L401 |
8,749 | eBay/ebayui-core | src/components/ebay-carousel/index.js | getOffset | function getOffset(state) {
const { items, index } = state;
if (!items.length) {
return 0;
}
return Math.min(items[index].left, getMaxOffset(state)) || 0;
} | javascript | function getOffset(state) {
const { items, index } = state;
if (!items.length) {
return 0;
}
return Math.min(items[index].left, getMaxOffset(state)) || 0;
} | [
"function",
"getOffset",
"(",
"state",
")",
"{",
"const",
"{",
"items",
",",
"index",
"}",
"=",
"state",
";",
"if",
"(",
"!",
"items",
".",
"length",
")",
"{",
"return",
"0",
";",
"}",
"return",
"Math",
".",
"min",
"(",
"items",
"[",
"index",
"]"... | Given the current widget state, finds the active offset left of the selected item.
Also automatically caps the offset at the max offset.
@param {object} state The widget state.
@return {number} | [
"Given",
"the",
"current",
"widget",
"state",
"finds",
"the",
"active",
"offset",
"left",
"of",
"the",
"selected",
"item",
".",
"Also",
"automatically",
"caps",
"the",
"offset",
"at",
"the",
"max",
"offset",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L410-L416 |
8,750 | eBay/ebayui-core | src/components/ebay-carousel/index.js | getMaxOffset | function getMaxOffset({ items, slideWidth }) {
if (!items.length) {
return 0;
}
return Math.max(items[items.length - 1].right - slideWidth, 0) || 0;
} | javascript | function getMaxOffset({ items, slideWidth }) {
if (!items.length) {
return 0;
}
return Math.max(items[items.length - 1].right - slideWidth, 0) || 0;
} | [
"function",
"getMaxOffset",
"(",
"{",
"items",
",",
"slideWidth",
"}",
")",
"{",
"if",
"(",
"!",
"items",
".",
"length",
")",
"{",
"return",
"0",
";",
"}",
"return",
"Math",
".",
"max",
"(",
"items",
"[",
"items",
".",
"length",
"-",
"1",
"]",
".... | Given the current widget state, finds the last valid offset.
@param {object} state The widget state.
@return {number} | [
"Given",
"the",
"current",
"widget",
"state",
"finds",
"the",
"last",
"valid",
"offset",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L424-L429 |
8,751 | eBay/ebayui-core | src/components/ebay-carousel/index.js | getSlide | function getSlide({ index, itemsPerSlide }, i = index) {
if (!itemsPerSlide) {
return;
}
return Math.ceil(i / itemsPerSlide);
} | javascript | function getSlide({ index, itemsPerSlide }, i = index) {
if (!itemsPerSlide) {
return;
}
return Math.ceil(i / itemsPerSlide);
} | [
"function",
"getSlide",
"(",
"{",
"index",
",",
"itemsPerSlide",
"}",
",",
"i",
"=",
"index",
")",
"{",
"if",
"(",
"!",
"itemsPerSlide",
")",
"{",
"return",
";",
"}",
"return",
"Math",
".",
"ceil",
"(",
"i",
"/",
"itemsPerSlide",
")",
";",
"}"
] | Gets the slide for a given index.
Defaults to the current index if none provided.
@param {object} state The widget state.
@param {number?} i the index to get the slide for.
@return {number} | [
"Gets",
"the",
"slide",
"for",
"a",
"given",
"index",
".",
"Defaults",
"to",
"the",
"current",
"index",
"if",
"none",
"provided",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L439-L445 |
8,752 | eBay/ebayui-core | src/components/ebay-carousel/index.js | normalizeIndex | function normalizeIndex({ items, itemsPerSlide }, index) {
let result = index;
result %= items.length || 1; // Ensure index is within bounds.
result -= result % (itemsPerSlide || 1); // Round index to the nearest valid slide index.
result = Math.abs(result); // Ensure positive value.
return result;
... | javascript | function normalizeIndex({ items, itemsPerSlide }, index) {
let result = index;
result %= items.length || 1; // Ensure index is within bounds.
result -= result % (itemsPerSlide || 1); // Round index to the nearest valid slide index.
result = Math.abs(result); // Ensure positive value.
return result;
... | [
"function",
"normalizeIndex",
"(",
"{",
"items",
",",
"itemsPerSlide",
"}",
",",
"index",
")",
"{",
"let",
"result",
"=",
"index",
";",
"result",
"%=",
"items",
".",
"length",
"||",
"1",
";",
"// Ensure index is within bounds.",
"result",
"-=",
"result",
"%"... | Ensures that an index is valid.
@param {object} state The widget state.
@param {number} index the index to normalize. | [
"Ensures",
"that",
"an",
"index",
"is",
"valid",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L453-L459 |
8,753 | eBay/ebayui-core | src/components/ebay-carousel/index.js | getNextIndex | function getNextIndex(state, delta) {
const { index, items, slideWidth, itemsPerSlide } = state;
let i = index;
let item;
// If going backward from 0, we go to the end.
if (delta === LEFT && i === 0) {
i = items.length - 1;
} else {
// Find the index of the next item that is not... | javascript | function getNextIndex(state, delta) {
const { index, items, slideWidth, itemsPerSlide } = state;
let i = index;
let item;
// If going backward from 0, we go to the end.
if (delta === LEFT && i === 0) {
i = items.length - 1;
} else {
// Find the index of the next item that is not... | [
"function",
"getNextIndex",
"(",
"state",
",",
"delta",
")",
"{",
"const",
"{",
"index",
",",
"items",
",",
"slideWidth",
",",
"itemsPerSlide",
"}",
"=",
"state",
";",
"let",
"i",
"=",
"index",
";",
"let",
"item",
";",
"// If going backward from 0, we go to ... | Calculates the next valid index in a direction.
@param {object} state The widget state.
@param {-1|1} delta 1 for right and -1 for left.
@return {number} | [
"Calculates",
"the",
"next",
"valid",
"index",
"in",
"a",
"direction",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L468-L493 |
8,754 | eBay/ebayui-core | src/components/ebay-carousel/index.js | forEls | function forEls(parent, fn) {
let i = 0;
let child = parent.firstElementChild;
while (child) {
fn(child, i++);
child = child.nextElementSibling;
}
} | javascript | function forEls(parent, fn) {
let i = 0;
let child = parent.firstElementChild;
while (child) {
fn(child, i++);
child = child.nextElementSibling;
}
} | [
"function",
"forEls",
"(",
"parent",
",",
"fn",
")",
"{",
"let",
"i",
"=",
"0",
";",
"let",
"child",
"=",
"parent",
".",
"firstElementChild",
";",
"while",
"(",
"child",
")",
"{",
"fn",
"(",
"child",
",",
"i",
"++",
")",
";",
"child",
"=",
"child... | Calls a function on each element within a parent element.
@param {HTMLElement} parent The parent to walk through.
@param {(el: HTMLElement, i: number) => any} fn The function to call. | [
"Calls",
"a",
"function",
"on",
"each",
"element",
"within",
"a",
"parent",
"element",
"."
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-carousel/index.js#L501-L508 |
8,755 | eBay/ebayui-core | src/common/property-observer/index.js | observeRoot | function observeRoot(widget, attributes, callback, skipSetState) {
attributes.forEach(attribute => {
Object.defineProperty(widget.el, attribute, {
get() {
return widget.state[attribute];
},
set(value) {
if (!skipSetState) {
... | javascript | function observeRoot(widget, attributes, callback, skipSetState) {
attributes.forEach(attribute => {
Object.defineProperty(widget.el, attribute, {
get() {
return widget.state[attribute];
},
set(value) {
if (!skipSetState) {
... | [
"function",
"observeRoot",
"(",
"widget",
",",
"attributes",
",",
"callback",
",",
"skipSetState",
")",
"{",
"attributes",
".",
"forEach",
"(",
"attribute",
"=>",
"{",
"Object",
".",
"defineProperty",
"(",
"widget",
".",
"el",
",",
"attribute",
",",
"{",
"... | For each attribute, define getter and setter on root DOM element of the widget
@param {Object} widget
@param {Array} attributes
@param {Function} callback
@param {Boolean} skipSetState: useful for handling setState in your component, rather than here | [
"For",
"each",
"attribute",
"define",
"getter",
"and",
"setter",
"on",
"root",
"DOM",
"element",
"of",
"the",
"widget"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/property-observer/index.js#L11-L27 |
8,756 | eBay/ebayui-core | src/common/property-observer/index.js | observeInner | function observeInner(widget, el, attribute, path, dirtyPath, callback) {
Object.defineProperty(el, attribute, {
get() {
return _get(widget.state, `${path}.${attribute}`);
},
set(value) {
_set(widget.state, `${path}.${attribute}`, value);
if (dirtyPath) {
... | javascript | function observeInner(widget, el, attribute, path, dirtyPath, callback) {
Object.defineProperty(el, attribute, {
get() {
return _get(widget.state, `${path}.${attribute}`);
},
set(value) {
_set(widget.state, `${path}.${attribute}`, value);
if (dirtyPath) {
... | [
"function",
"observeInner",
"(",
"widget",
",",
"el",
",",
"attribute",
",",
"path",
",",
"dirtyPath",
",",
"callback",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"el",
",",
"attribute",
",",
"{",
"get",
"(",
")",
"{",
"return",
"_get",
"(",
"widg... | Define getter and setter on a non-root DOM element of the widget
@param {Object} widget: Widget instance
@param {HTMLElement} el: Element for attaching observer
@param {String} attribute: Name of stateful property
@param {String} path: Path to part of state that needs to be accessed
@param {String} dirtyPath: Path to u... | [
"Define",
"getter",
"and",
"setter",
"on",
"a",
"non",
"-",
"root",
"DOM",
"element",
"of",
"the",
"widget"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/property-observer/index.js#L37-L50 |
8,757 | eBay/ebayui-core | src/common/element-scroll/index.js | scroll | function scroll(el) {
if (!el) {
return;
}
const parentEl = el && el.parentElement;
const offsetBottom = el.offsetTop + el.offsetHeight;
const scrollBottom = parentEl.scrollTop + parentEl.offsetHeight;
if (el.offsetTop < parentEl.scrollTop) {
parentEl.scrollTop = el.offsetTop;
... | javascript | function scroll(el) {
if (!el) {
return;
}
const parentEl = el && el.parentElement;
const offsetBottom = el.offsetTop + el.offsetHeight;
const scrollBottom = parentEl.scrollTop + parentEl.offsetHeight;
if (el.offsetTop < parentEl.scrollTop) {
parentEl.scrollTop = el.offsetTop;
... | [
"function",
"scroll",
"(",
"el",
")",
"{",
"if",
"(",
"!",
"el",
")",
"{",
"return",
";",
"}",
"const",
"parentEl",
"=",
"el",
"&&",
"el",
".",
"parentElement",
";",
"const",
"offsetBottom",
"=",
"el",
".",
"offsetTop",
"+",
"el",
".",
"offsetHeight"... | Scrolls the parent element until the child element is in view | [
"Scrolls",
"the",
"parent",
"element",
"until",
"the",
"child",
"element",
"is",
"in",
"view"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/element-scroll/index.js#L4-L18 |
8,758 | eBay/ebayui-core | src/common/event-utils/index.js | handleKeydown | function handleKeydown(keyCodes, e, callback) {
const keyCode = e.charCode || e.keyCode;
if (keyCodes.indexOf(keyCode) !== -1) {
callback();
}
} | javascript | function handleKeydown(keyCodes, e, callback) {
const keyCode = e.charCode || e.keyCode;
if (keyCodes.indexOf(keyCode) !== -1) {
callback();
}
} | [
"function",
"handleKeydown",
"(",
"keyCodes",
",",
"e",
",",
"callback",
")",
"{",
"const",
"keyCode",
"=",
"e",
".",
"charCode",
"||",
"e",
".",
"keyCode",
";",
"if",
"(",
"keyCodes",
".",
"indexOf",
"(",
"keyCode",
")",
"!==",
"-",
"1",
")",
"{",
... | Generic keydown handler used by more specific cases
@param {Array} keyCodes: List of acceptable keyCodes
@param {KeyboardEvent} e
@param {Function} callback | [
"Generic",
"keydown",
"handler",
"used",
"by",
"more",
"specific",
"cases"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/event-utils/index.js#L7-L12 |
8,759 | eBay/ebayui-core | src/common/event-utils/index.js | handleNotKeydown | function handleNotKeydown(keyCodes, e, callback) {
const keyCode = e.charCode || e.keyCode;
if (keyCodes.indexOf(keyCode) === -1) {
callback();
}
} | javascript | function handleNotKeydown(keyCodes, e, callback) {
const keyCode = e.charCode || e.keyCode;
if (keyCodes.indexOf(keyCode) === -1) {
callback();
}
} | [
"function",
"handleNotKeydown",
"(",
"keyCodes",
",",
"e",
",",
"callback",
")",
"{",
"const",
"keyCode",
"=",
"e",
".",
"charCode",
"||",
"e",
".",
"keyCode",
";",
"if",
"(",
"keyCodes",
".",
"indexOf",
"(",
"keyCode",
")",
"===",
"-",
"1",
")",
"{"... | inverse of found keys | [
"inverse",
"of",
"found",
"keys"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/common/event-utils/index.js#L15-L20 |
8,760 | eBay/ebayui-core | demo/utils.js | isDirectory | function isDirectory(obj) {
return obj.sources.every(path => {
try {
return fs.lstatSync(path).isDirectory();
} catch (e) {
return false;
}
});
} | javascript | function isDirectory(obj) {
return obj.sources.every(path => {
try {
return fs.lstatSync(path).isDirectory();
} catch (e) {
return false;
}
});
} | [
"function",
"isDirectory",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"sources",
".",
"every",
"(",
"path",
"=>",
"{",
"try",
"{",
"return",
"fs",
".",
"lstatSync",
"(",
"path",
")",
".",
"isDirectory",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
... | check that paths exist as directories | [
"check",
"that",
"paths",
"exist",
"as",
"directories"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/demo/utils.js#L4-L12 |
8,761 | eBay/ebayui-core | src/components/ebay-combobox-readonly/index.js | handleOptionClick | function handleOptionClick(event) {
let el;
// find the element with the data
// start with the target element
if (event.target.dataset.optionValue) {
el = event.target;
// check up the tree one level (in case option text or status was clicked)
} else if (event.target.parentNode.dataset... | javascript | function handleOptionClick(event) {
let el;
// find the element with the data
// start with the target element
if (event.target.dataset.optionValue) {
el = event.target;
// check up the tree one level (in case option text or status was clicked)
} else if (event.target.parentNode.dataset... | [
"function",
"handleOptionClick",
"(",
"event",
")",
"{",
"let",
"el",
";",
"// find the element with the data",
"// start with the target element",
"if",
"(",
"event",
".",
"target",
".",
"dataset",
".",
"optionValue",
")",
"{",
"el",
"=",
"event",
".",
"target",
... | Handle mouse click for option
@param {MouseEvent} event | [
"Handle",
"mouse",
"click",
"for",
"option"
] | a7250c25eaab355881947c159301a78865d0d5c9 | https://github.com/eBay/ebayui-core/blob/a7250c25eaab355881947c159301a78865d0d5c9/src/components/ebay-combobox-readonly/index.js#L117-L132 |
8,762 | mattermost/mattermost-redux | src/actions/websocket.js | handleChannelConvertedEvent | function handleChannelConvertedEvent(msg) {
return (dispatch, getState) => {
const channelId = msg.data.channel_id;
if (channelId) {
const channel = getChannel(getState(), channelId);
if (channel) {
dispatch({
type: ChannelTypes.RECEIVED_CH... | javascript | function handleChannelConvertedEvent(msg) {
return (dispatch, getState) => {
const channelId = msg.data.channel_id;
if (channelId) {
const channel = getChannel(getState(), channelId);
if (channel) {
dispatch({
type: ChannelTypes.RECEIVED_CH... | [
"function",
"handleChannelConvertedEvent",
"(",
"msg",
")",
"{",
"return",
"(",
"dispatch",
",",
"getState",
")",
"=>",
"{",
"const",
"channelId",
"=",
"msg",
".",
"data",
".",
"channel_id",
";",
"if",
"(",
"channelId",
")",
"{",
"const",
"channel",
"=",
... | handleChannelConvertedEvent handles updating of channel which is converted from public to private | [
"handleChannelConvertedEvent",
"handles",
"updating",
"of",
"channel",
"which",
"is",
"converted",
"from",
"public",
"to",
"private"
] | a6b5a325126821c8e6fe22a3dbef747a4d325c5e | https://github.com/mattermost/mattermost-redux/blob/a6b5a325126821c8e6fe22a3dbef747a4d325c5e/src/actions/websocket.js#L546-L559 |
8,763 | zeit/ms | index.js | plural | function plural(ms, msAbs, n, name) {
var isPlural = msAbs >= n * 1.5;
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
} | javascript | function plural(ms, msAbs, n, name) {
var isPlural = msAbs >= n * 1.5;
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
} | [
"function",
"plural",
"(",
"ms",
",",
"msAbs",
",",
"n",
",",
"name",
")",
"{",
"var",
"isPlural",
"=",
"msAbs",
">=",
"n",
"*",
"1.5",
";",
"return",
"Math",
".",
"round",
"(",
"ms",
"/",
"n",
")",
"+",
"' '",
"+",
"name",
"+",
"(",
"isPlural"... | Pluralization helper. | [
"Pluralization",
"helper",
"."
] | d1add60365fe2340b750b1f7a254b83bea34e52d | https://github.com/zeit/ms/blob/d1add60365fe2340b750b1f7a254b83bea34e52d/index.js#L159-L162 |
8,764 | pqina/vue-filepond | dist/vue-filepond.js | getNativeConstructorFromType | function getNativeConstructorFromType(type) {
return {
string: String,
boolean: Boolean,
array: Array,
function: Function,
int: Number,
serverapi: Object,
object: Object
}[type];
} | javascript | function getNativeConstructorFromType(type) {
return {
string: String,
boolean: Boolean,
array: Array,
function: Function,
int: Number,
serverapi: Object,
object: Object
}[type];
} | [
"function",
"getNativeConstructorFromType",
"(",
"type",
")",
"{",
"return",
"{",
"string",
":",
"String",
",",
"boolean",
":",
"Boolean",
",",
"array",
":",
"Array",
",",
"function",
":",
"Function",
",",
"int",
":",
"Number",
",",
"serverapi",
":",
"Obje... | Setup initial prop types and update when plugins are added | [
"Setup",
"initial",
"prop",
"types",
"and",
"update",
"when",
"plugins",
"are",
"added"
] | bf7ea99e11da095eb10b4f703be0827e807130b7 | https://github.com/pqina/vue-filepond/blob/bf7ea99e11da095eb10b4f703be0827e807130b7/dist/vue-filepond.js#L46-L56 |
8,765 | greggman/twgl.js | src/helper.js | copyExistingProperties | function copyExistingProperties(src, dst) {
Object.keys(dst).forEach(function(key) {
if (dst.hasOwnProperty(key) && src.hasOwnProperty(key)) {
dst[key] = src[key];
}
});
} | javascript | function copyExistingProperties(src, dst) {
Object.keys(dst).forEach(function(key) {
if (dst.hasOwnProperty(key) && src.hasOwnProperty(key)) {
dst[key] = src[key];
}
});
} | [
"function",
"copyExistingProperties",
"(",
"src",
",",
"dst",
")",
"{",
"Object",
".",
"keys",
"(",
"dst",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"dst",
".",
"hasOwnProperty",
"(",
"key",
")",
"&&",
"src",
".",
"hasOwn... | Copies properties from source to dest only if a matching key is in dest
@param {Object.<string, ?>} src the source
@param {Object.<string, ?>} dst the dest
@private | [
"Copies",
"properties",
"from",
"source",
"to",
"dest",
"only",
"if",
"a",
"matching",
"key",
"is",
"in",
"dest"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/helper.js#L49-L55 |
8,766 | greggman/twgl.js | src/twgl.js | setDefaults | function setDefaults(newDefaults) {
helper.copyExistingProperties(newDefaults, defaults);
attributes.setAttributeDefaults_(newDefaults); // eslint-disable-line
textures.setTextureDefaults_(newDefaults); // eslint-disable-line
} | javascript | function setDefaults(newDefaults) {
helper.copyExistingProperties(newDefaults, defaults);
attributes.setAttributeDefaults_(newDefaults); // eslint-disable-line
textures.setTextureDefaults_(newDefaults); // eslint-disable-line
} | [
"function",
"setDefaults",
"(",
"newDefaults",
")",
"{",
"helper",
".",
"copyExistingProperties",
"(",
"newDefaults",
",",
"defaults",
")",
";",
"attributes",
".",
"setAttributeDefaults_",
"(",
"newDefaults",
")",
";",
"// eslint-disable-line",
"textures",
".",
"set... | Various default settings for twgl.
Note: You can call this any number of times. Example:
twgl.setDefaults({ textureColor: [1, 0, 0, 1] });
twgl.setDefaults({ attribPrefix: 'a_' });
is equivalent to
twgl.setDefaults({
textureColor: [1, 0, 0, 1],
attribPrefix: 'a_',
});
@typedef {Object} Defaults
@property {string} ... | [
"Various",
"default",
"settings",
"for",
"twgl",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/twgl.js#L133-L137 |
8,767 | greggman/twgl.js | src/twgl.js | addExtensionsToContext | function addExtensionsToContext(gl) {
for (let ii = 0; ii < supportedExtensions.length; ++ii) {
addExtensionToContext(gl, supportedExtensions[ii]);
}
} | javascript | function addExtensionsToContext(gl) {
for (let ii = 0; ii < supportedExtensions.length; ++ii) {
addExtensionToContext(gl, supportedExtensions[ii]);
}
} | [
"function",
"addExtensionsToContext",
"(",
"gl",
")",
"{",
"for",
"(",
"let",
"ii",
"=",
"0",
";",
"ii",
"<",
"supportedExtensions",
".",
"length",
";",
"++",
"ii",
")",
"{",
"addExtensionToContext",
"(",
"gl",
",",
"supportedExtensions",
"[",
"ii",
"]",
... | Attempts to enable all of the following extensions
and add their functions and constants to the
`WebGLRenderingContext` using their normal non-extension like names.
ANGLE_instanced_arrays
EXT_blend_minmax
EXT_color_buffer_float
EXT_color_buffer_half_float
EXT_disjoint_timer_query
EXT_disjoint_timer_query_webgl2
EXT_fr... | [
"Attempts",
"to",
"enable",
"all",
"of",
"the",
"following",
"extensions",
"and",
"add",
"their",
"functions",
"and",
"constants",
"to",
"the",
"WebGLRenderingContext",
"using",
"their",
"normal",
"non",
"-",
"extension",
"like",
"names",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/twgl.js#L267-L271 |
8,768 | greggman/twgl.js | src/twgl.js | createContext | function createContext(canvas, opt_attribs) {
const names = ["webgl2", "webgl", "experimental-webgl"];
let context = null;
for (let ii = 0; ii < names.length; ++ii) {
context = canvas.getContext(names[ii], opt_attribs);
if (context) {
if (defaults.addExtensionsToContext) {
addExtensionsToCon... | javascript | function createContext(canvas, opt_attribs) {
const names = ["webgl2", "webgl", "experimental-webgl"];
let context = null;
for (let ii = 0; ii < names.length; ++ii) {
context = canvas.getContext(names[ii], opt_attribs);
if (context) {
if (defaults.addExtensionsToContext) {
addExtensionsToCon... | [
"function",
"createContext",
"(",
"canvas",
",",
"opt_attribs",
")",
"{",
"const",
"names",
"=",
"[",
"\"webgl2\"",
",",
"\"webgl\"",
",",
"\"experimental-webgl\"",
"]",
";",
"let",
"context",
"=",
"null",
";",
"for",
"(",
"let",
"ii",
"=",
"0",
";",
"ii... | Creates a webgl context.
Will return a WebGL2 context if possible.
You can check if it's WebGL2 with
twgl.isWebGL2(gl);
@param {HTMLCanvasElement} canvas The canvas tag to get
context from. If one is not passed in one will be
created.
@return {WebGLRenderingContext} The created context. | [
"Creates",
"a",
"webgl",
"context",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/twgl.js#L327-L340 |
8,769 | greggman/twgl.js | src/draw.js | drawBufferInfo | function drawBufferInfo(gl, bufferInfo, type, count, offset, instanceCount) {
type = type === undefined ? gl.TRIANGLES : type;
const indices = bufferInfo.indices;
const elementType = bufferInfo.elementType;
const numElements = count === undefined ? bufferInfo.numElements : count;
offset = offset === undefined... | javascript | function drawBufferInfo(gl, bufferInfo, type, count, offset, instanceCount) {
type = type === undefined ? gl.TRIANGLES : type;
const indices = bufferInfo.indices;
const elementType = bufferInfo.elementType;
const numElements = count === undefined ? bufferInfo.numElements : count;
offset = offset === undefined... | [
"function",
"drawBufferInfo",
"(",
"gl",
",",
"bufferInfo",
",",
"type",
",",
"count",
",",
"offset",
",",
"instanceCount",
")",
"{",
"type",
"=",
"type",
"===",
"undefined",
"?",
"gl",
".",
"TRIANGLES",
":",
"type",
";",
"const",
"indices",
"=",
"buffer... | Drawing related functions
For backward compatibily they are available at both `twgl.draw` and `twgl`
itself
See {@link module:twgl} for core functions
@module twgl/draw
Calls `gl.drawElements` or `gl.drawArrays`, whichever is appropriate
normally you'd call `gl.drawElements` or `gl.drawArrays` yourself
but callin... | [
"Drawing",
"related",
"functions"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/draw.js#L52-L71 |
8,770 | greggman/twgl.js | src/typedarrays.js | getGLTypeForTypedArray | function getGLTypeForTypedArray(typedArray) {
if (typedArray instanceof Int8Array) { return BYTE; } // eslint-disable-line
if (typedArray instanceof Uint8Array) { return UNSIGNED_BYTE; } // eslint-disable-line
if (typedArray instanceof Uint8ClampedArray) { return UNSIGNED_BYTE; } // esl... | javascript | function getGLTypeForTypedArray(typedArray) {
if (typedArray instanceof Int8Array) { return BYTE; } // eslint-disable-line
if (typedArray instanceof Uint8Array) { return UNSIGNED_BYTE; } // eslint-disable-line
if (typedArray instanceof Uint8ClampedArray) { return UNSIGNED_BYTE; } // esl... | [
"function",
"getGLTypeForTypedArray",
"(",
"typedArray",
")",
"{",
"if",
"(",
"typedArray",
"instanceof",
"Int8Array",
")",
"{",
"return",
"BYTE",
";",
"}",
"// eslint-disable-line",
"if",
"(",
"typedArray",
"instanceof",
"Uint8Array",
")",
"{",
"return",
"UNSIGNE... | Get the GL type for a typedArray
@param {ArrayBufferView} typedArray a typedArray
@return {number} the GL type for array. For example pass in an `Int8Array` and `gl.BYTE` will
be returned. Pass in a `Uint32Array` and `gl.UNSIGNED_INT` will be returned
@memberOf module:twgl/typedArray | [
"Get",
"the",
"GL",
"type",
"for",
"a",
"typedArray"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/typedarrays.js#L87-L97 |
8,771 | greggman/twgl.js | src/typedarrays.js | getGLTypeForTypedArrayType | function getGLTypeForTypedArrayType(typedArrayType) {
if (typedArrayType === Int8Array) { return BYTE; } // eslint-disable-line
if (typedArrayType === Uint8Array) { return UNSIGNED_BYTE; } // eslint-disable-line
if (typedArrayType === Uint8ClampedArray) { return UNSIGNED_BYTE; } // esli... | javascript | function getGLTypeForTypedArrayType(typedArrayType) {
if (typedArrayType === Int8Array) { return BYTE; } // eslint-disable-line
if (typedArrayType === Uint8Array) { return UNSIGNED_BYTE; } // eslint-disable-line
if (typedArrayType === Uint8ClampedArray) { return UNSIGNED_BYTE; } // esli... | [
"function",
"getGLTypeForTypedArrayType",
"(",
"typedArrayType",
")",
"{",
"if",
"(",
"typedArrayType",
"===",
"Int8Array",
")",
"{",
"return",
"BYTE",
";",
"}",
"// eslint-disable-line",
"if",
"(",
"typedArrayType",
"===",
"Uint8Array",
")",
"{",
"return",
"UNSIG... | Get the GL type for a typedArray type
@param {ArrayBufferView} typedArrayType a typedArray constructor
@return {number} the GL type for type. For example pass in `Int8Array` and `gl.BYTE` will
be returned. Pass in `Uint32Array` and `gl.UNSIGNED_INT` will be returned
@memberOf module:twgl/typedArray | [
"Get",
"the",
"GL",
"type",
"for",
"a",
"typedArray",
"type"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/typedarrays.js#L106-L116 |
8,772 | greggman/twgl.js | src/m4.js | negate | function negate(m, dst) {
dst = dst || new MatType(16);
dst[ 0] = -m[ 0];
dst[ 1] = -m[ 1];
dst[ 2] = -m[ 2];
dst[ 3] = -m[ 3];
dst[ 4] = -m[ 4];
dst[ 5] = -m[ 5];
dst[ 6] = -m[ 6];
dst[ 7] = -m[ 7];
dst[ 8] = -m[ 8];
dst[ 9] = -m[ 9];
dst[10] = -m[10];
dst[11] = -m[11];
dst[12] = -m[12];
... | javascript | function negate(m, dst) {
dst = dst || new MatType(16);
dst[ 0] = -m[ 0];
dst[ 1] = -m[ 1];
dst[ 2] = -m[ 2];
dst[ 3] = -m[ 3];
dst[ 4] = -m[ 4];
dst[ 5] = -m[ 5];
dst[ 6] = -m[ 6];
dst[ 7] = -m[ 7];
dst[ 8] = -m[ 8];
dst[ 9] = -m[ 9];
dst[10] = -m[10];
dst[11] = -m[11];
dst[12] = -m[12];
... | [
"function",
"negate",
"(",
"m",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"-",
"m",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"-",
"m",
"[",
"1",
"]",
";",
"dst... | Negates a matrix.
@param {module:twgl/m4.Mat4} m The matrix.
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} -m.
@memberOf module:twgl/m4 | [
"Negates",
"a",
"matrix",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L82-L103 |
8,773 | greggman/twgl.js | src/m4.js | copy | function copy(m, dst) {
dst = dst || new MatType(16);
dst[ 0] = m[ 0];
dst[ 1] = m[ 1];
dst[ 2] = m[ 2];
dst[ 3] = m[ 3];
dst[ 4] = m[ 4];
dst[ 5] = m[ 5];
dst[ 6] = m[ 6];
dst[ 7] = m[ 7];
dst[ 8] = m[ 8];
dst[ 9] = m[ 9];
dst[10] = m[10];
dst[11] = m[11];
dst[12] = m[12];
dst[13] = m[13... | javascript | function copy(m, dst) {
dst = dst || new MatType(16);
dst[ 0] = m[ 0];
dst[ 1] = m[ 1];
dst[ 2] = m[ 2];
dst[ 3] = m[ 3];
dst[ 4] = m[ 4];
dst[ 5] = m[ 5];
dst[ 6] = m[ 6];
dst[ 7] = m[ 7];
dst[ 8] = m[ 8];
dst[ 9] = m[ 9];
dst[10] = m[10];
dst[11] = m[11];
dst[12] = m[12];
dst[13] = m[13... | [
"function",
"copy",
"(",
"m",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"m",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"m",
"[",
"1",
"]",
";",
"dst",
"[",
"2",... | Copies a matrix.
@param {module:twgl/m4.Mat4} m The matrix.
@param {module:twgl/m4.Mat4} [dst] The matrix.
@return {module:twgl/m4.Mat4} A copy of m.
@memberOf module:twgl/m4 | [
"Copies",
"a",
"matrix",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L112-L133 |
8,774 | greggman/twgl.js | src/m4.js | identity | function identity(dst) {
dst = dst || new MatType(16);
dst[ 0] = 1;
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = 1;
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = 1;
dst[11] = 0;
dst[12] = 0;
dst[13] = 0;
dst[14] = 0;
dst[15] = 1;
return dst;
} | javascript | function identity(dst) {
dst = dst || new MatType(16);
dst[ 0] = 1;
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = 1;
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = 1;
dst[11] = 0;
dst[12] = 0;
dst[13] = 0;
dst[14] = 0;
dst[15] = 1;
return dst;
} | [
"function",
"identity",
"(",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"1",
";",
"dst",
"[",
"1",
"]",
"=",
"0",
";",
"dst",
"[",
"2",
"]",
"=",
"0",
";",
"dst",
"[",
"3",
... | Creates an n-by-n identity matrix.
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} An n-by-n identity matrix.
@memberOf module:twgl/m4 | [
"Creates",
"an",
"n",
"-",
"by",
"-",
"n",
"identity",
"matrix",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L142-L163 |
8,775 | greggman/twgl.js | src/m4.js | transpose | function transpose(m, dst) {
dst = dst || new MatType(16);
if (dst === m) {
let t;
t = m[1];
m[1] = m[4];
m[4] = t;
t = m[2];
m[2] = m[8];
m[8] = t;
t = m[3];
m[3] = m[12];
m[12] = t;
t = m[6];
m[6] = m[9];
m[9] = t;
t = m[7];
m[7] = m[13];
m[13] ... | javascript | function transpose(m, dst) {
dst = dst || new MatType(16);
if (dst === m) {
let t;
t = m[1];
m[1] = m[4];
m[4] = t;
t = m[2];
m[2] = m[8];
m[8] = t;
t = m[3];
m[3] = m[12];
m[12] = t;
t = m[6];
m[6] = m[9];
m[9] = t;
t = m[7];
m[7] = m[13];
m[13] ... | [
"function",
"transpose",
"(",
"m",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"if",
"(",
"dst",
"===",
"m",
")",
"{",
"let",
"t",
";",
"t",
"=",
"m",
"[",
"1",
"]",
";",
"m",
"[",
"1",
"]",
"=",
... | Takes the transpose of a matrix.
@param {module:twgl/m4.Mat4} m The matrix.
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} The transpose of m.
@memberOf module:twgl/m4 | [
"Takes",
"the",
"transpose",
"of",
"a",
"matrix",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L172-L238 |
8,776 | greggman/twgl.js | src/m4.js | setTranslation | function setTranslation(a, v, dst) {
dst = dst || identity();
if (a !== dst) {
dst[ 0] = a[ 0];
dst[ 1] = a[ 1];
dst[ 2] = a[ 2];
dst[ 3] = a[ 3];
dst[ 4] = a[ 4];
dst[ 5] = a[ 5];
dst[ 6] = a[ 6];
dst[ 7] = a[ 7];
dst[ 8] = a[ 8];
dst[ 9] = a[ 9];
dst[10] = a[10];
ds... | javascript | function setTranslation(a, v, dst) {
dst = dst || identity();
if (a !== dst) {
dst[ 0] = a[ 0];
dst[ 1] = a[ 1];
dst[ 2] = a[ 2];
dst[ 3] = a[ 3];
dst[ 4] = a[ 4];
dst[ 5] = a[ 5];
dst[ 6] = a[ 6];
dst[ 7] = a[ 7];
dst[ 8] = a[ 8];
dst[ 9] = a[ 9];
dst[10] = a[10];
ds... | [
"function",
"setTranslation",
"(",
"a",
",",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"identity",
"(",
")",
";",
"if",
"(",
"a",
"!==",
"dst",
")",
"{",
"dst",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
... | Sets the translation component of a 4-by-4 matrix to the given
vector.
@param {module:twgl/m4.Mat4} a The matrix.
@param {module:twgl/v3.Vec3} v The vector.
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none, a new one is created.
@return {module:twgl/m4.Mat4} a once modified.
@memberOf module:twgl/m4 | [
"Sets",
"the",
"translation",
"component",
"of",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"to",
"the",
"given",
"vector",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L407-L428 |
8,777 | greggman/twgl.js | src/m4.js | getTranslation | function getTranslation(m, dst) {
dst = dst || v3.create();
dst[0] = m[12];
dst[1] = m[13];
dst[2] = m[14];
return dst;
} | javascript | function getTranslation(m, dst) {
dst = dst || v3.create();
dst[0] = m[12];
dst[1] = m[13];
dst[2] = m[14];
return dst;
} | [
"function",
"getTranslation",
"(",
"m",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"v3",
".",
"create",
"(",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"m",
"[",
"12",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"m",
"[",
"13",
"]",
";",
"dst",
"[... | Returns the translation component of a 4-by-4 matrix as a vector with 3
entries.
@param {module:twgl/m4.Mat4} m The matrix.
@param {module:twgl/v3.Vec3} [dst] vector.
@return {module:twgl/v3.Vec3} The translation component of m.
@memberOf module:twgl/m4 | [
"Returns",
"the",
"translation",
"component",
"of",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"as",
"a",
"vector",
"with",
"3",
"entries",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L438-L444 |
8,778 | greggman/twgl.js | src/m4.js | getAxis | function getAxis(m, axis, dst) {
dst = dst || v3.create();
const off = axis * 4;
dst[0] = m[off + 0];
dst[1] = m[off + 1];
dst[2] = m[off + 2];
return dst;
} | javascript | function getAxis(m, axis, dst) {
dst = dst || v3.create();
const off = axis * 4;
dst[0] = m[off + 0];
dst[1] = m[off + 1];
dst[2] = m[off + 2];
return dst;
} | [
"function",
"getAxis",
"(",
"m",
",",
"axis",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"v3",
".",
"create",
"(",
")",
";",
"const",
"off",
"=",
"axis",
"*",
"4",
";",
"dst",
"[",
"0",
"]",
"=",
"m",
"[",
"off",
"+",
"0",
"]",
";",
"... | Returns an axis of a 4x4 matrix as a vector with 3 entries
@param {module:twgl/m4.Mat4} m The matrix.
@param {number} axis The axis 0 = x, 1 = y, 2 = z;
@return {module:twgl/v3.Vec3} [dst] vector.
@return {module:twgl/v3.Vec3} The axis component of m.
@memberOf module:twgl/m4 | [
"Returns",
"an",
"axis",
"of",
"a",
"4x4",
"matrix",
"as",
"a",
"vector",
"with",
"3",
"entries"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L454-L461 |
8,779 | greggman/twgl.js | src/m4.js | setAxis | function setAxis(a, v, axis, dst) {
if (dst !== a) {
dst = copy(a, dst);
}
const off = axis * 4;
dst[off + 0] = v[0];
dst[off + 1] = v[1];
dst[off + 2] = v[2];
return dst;
} | javascript | function setAxis(a, v, axis, dst) {
if (dst !== a) {
dst = copy(a, dst);
}
const off = axis * 4;
dst[off + 0] = v[0];
dst[off + 1] = v[1];
dst[off + 2] = v[2];
return dst;
} | [
"function",
"setAxis",
"(",
"a",
",",
"v",
",",
"axis",
",",
"dst",
")",
"{",
"if",
"(",
"dst",
"!==",
"a",
")",
"{",
"dst",
"=",
"copy",
"(",
"a",
",",
"dst",
")",
";",
"}",
"const",
"off",
"=",
"axis",
"*",
"4",
";",
"dst",
"[",
"off",
... | Sets an axis of a 4x4 matrix as a vector with 3 entries
@param {module:twgl/v3.Vec3} v the axis vector
@param {number} axis The axis 0 = x, 1 = y, 2 = z;
@param {module:twgl/m4.Mat4} [dst] The matrix to set. If none, a new one is created.
@return {module:twgl/m4.Mat4} dst
@memberOf module:twgl/m4 | [
"Sets",
"an",
"axis",
"of",
"a",
"4x4",
"matrix",
"as",
"a",
"vector",
"with",
"3",
"entries"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L471-L480 |
8,780 | greggman/twgl.js | src/m4.js | perspective | function perspective(fieldOfViewYInRadians, aspect, zNear, zFar, dst) {
dst = dst || new MatType(16);
const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);
const rangeInv = 1.0 / (zNear - zFar);
dst[0] = f / aspect;
dst[1] = 0;
dst[2] = 0;
dst[3] = 0;
dst[4] = 0;
dst[5] = f;
dst[... | javascript | function perspective(fieldOfViewYInRadians, aspect, zNear, zFar, dst) {
dst = dst || new MatType(16);
const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);
const rangeInv = 1.0 / (zNear - zFar);
dst[0] = f / aspect;
dst[1] = 0;
dst[2] = 0;
dst[3] = 0;
dst[4] = 0;
dst[5] = f;
dst[... | [
"function",
"perspective",
"(",
"fieldOfViewYInRadians",
",",
"aspect",
",",
"zNear",
",",
"zFar",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"f",
"=",
"Math",
".",
"tan",
"(",
"Math",
".",
"PI",
... | Computes a 4-by-4 perspective transformation matrix given the angular height
of the frustum, the aspect ratio, and the near and far clipping planes. The
arguments define a frustum extending in the negative z direction. The given
angle is the vertical angle of the frustum, and the horizontal angle is
determined to pro... | [
"Computes",
"a",
"4",
"-",
"by",
"-",
"4",
"perspective",
"transformation",
"matrix",
"given",
"the",
"angular",
"height",
"of",
"the",
"frustum",
"the",
"aspect",
"ratio",
"and",
"the",
"near",
"and",
"far",
"clipping",
"planes",
".",
"The",
"arguments",
... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L503-L530 |
8,781 | greggman/twgl.js | src/m4.js | ortho | function ortho(left, right, bottom, top, near, far, dst) {
dst = dst || new MatType(16);
dst[0] = 2 / (right - left);
dst[1] = 0;
dst[2] = 0;
dst[3] = 0;
dst[4] = 0;
dst[5] = 2 / (top - bottom);
dst[6] = 0;
dst[7] = 0;
dst[8] = 0;
dst[9] = 0;
dst[10] = 2 / (near - far);
dst[11] = ... | javascript | function ortho(left, right, bottom, top, near, far, dst) {
dst = dst || new MatType(16);
dst[0] = 2 / (right - left);
dst[1] = 0;
dst[2] = 0;
dst[3] = 0;
dst[4] = 0;
dst[5] = 2 / (top - bottom);
dst[6] = 0;
dst[7] = 0;
dst[8] = 0;
dst[9] = 0;
dst[10] = 2 / (near - far);
dst[11] = ... | [
"function",
"ortho",
"(",
"left",
",",
"right",
",",
"bottom",
",",
"top",
",",
"near",
",",
"far",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"2",
"/",
"(",
"right",
"-",
... | Computes a 4-by-4 othogonal transformation matrix given the left, right,
bottom, and top dimensions of the near clipping plane as well as the
near and far clipping plane distances.
@param {number} left Left side of the near clipping plane viewport.
@param {number} right Right side of the near clipping plane viewport.
@... | [
"Computes",
"a",
"4",
"-",
"by",
"-",
"4",
"othogonal",
"transformation",
"matrix",
"given",
"the",
"left",
"right",
"bottom",
"and",
"top",
"dimensions",
"of",
"the",
"near",
"clipping",
"plane",
"as",
"well",
"as",
"the",
"near",
"and",
"far",
"clipping"... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L548-L572 |
8,782 | greggman/twgl.js | src/m4.js | frustum | function frustum(left, right, bottom, top, near, far, dst) {
dst = dst || new MatType(16);
const dx = (right - left);
const dy = (top - bottom);
const dz = (near - far);
dst[ 0] = 2 * near / dx;
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = 2 * near / dy;
dst[ 6] = 0;
dst[ 7] =... | javascript | function frustum(left, right, bottom, top, near, far, dst) {
dst = dst || new MatType(16);
const dx = (right - left);
const dy = (top - bottom);
const dz = (near - far);
dst[ 0] = 2 * near / dx;
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = 2 * near / dy;
dst[ 6] = 0;
dst[ 7] =... | [
"function",
"frustum",
"(",
"left",
",",
"right",
",",
"bottom",
",",
"top",
",",
"near",
",",
"far",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"dx",
"=",
"(",
"right",
"-",
"left",
")",
";",... | Computes a 4-by-4 perspective transformation matrix given the left, right,
top, bottom, near and far clipping planes. The arguments define a frustum
extending in the negative z direction. The arguments near and far are the
distances to the near and far clipping planes. Note that near and far are not
z coordinates, but ... | [
"Computes",
"a",
"4",
"-",
"by",
"-",
"4",
"perspective",
"transformation",
"matrix",
"given",
"the",
"left",
"right",
"top",
"bottom",
"near",
"and",
"far",
"clipping",
"planes",
".",
"The",
"arguments",
"define",
"a",
"frustum",
"extending",
"in",
"the",
... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L593-L618 |
8,783 | greggman/twgl.js | src/m4.js | lookAt | function lookAt(eye, target, up, dst) {
dst = dst || new MatType(16);
const xAxis = tempV3a;
const yAxis = tempV3b;
const zAxis = tempV3c;
v3.normalize(
v3.subtract(eye, target, zAxis), zAxis);
v3.normalize(v3.cross(up, zAxis, xAxis), xAxis);
v3.normalize(v3.cross(zAxis, xAxis, yAxis), yAxis);
... | javascript | function lookAt(eye, target, up, dst) {
dst = dst || new MatType(16);
const xAxis = tempV3a;
const yAxis = tempV3b;
const zAxis = tempV3c;
v3.normalize(
v3.subtract(eye, target, zAxis), zAxis);
v3.normalize(v3.cross(up, zAxis, xAxis), xAxis);
v3.normalize(v3.cross(zAxis, xAxis, yAxis), yAxis);
... | [
"function",
"lookAt",
"(",
"eye",
",",
"target",
",",
"up",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"xAxis",
"=",
"tempV3a",
";",
"const",
"yAxis",
"=",
"tempV3b",
";",
"const",
"zAxis",
"=",
... | Computes a 4-by-4 look-at transformation.
This is a matrix which positions the camera itself. If you want
a view matrix (a matrix which moves things in front of the camera)
take the inverse of this.
@param {module:twgl/v3.Vec3} eye The position of the eye.
@param {module:twgl/v3.Vec3} target The position meant to be ... | [
"Computes",
"a",
"4",
"-",
"by",
"-",
"4",
"look",
"-",
"at",
"transformation",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L634-L664 |
8,784 | greggman/twgl.js | src/m4.js | translation | function translation(v, dst) {
dst = dst || new MatType(16);
dst[ 0] = 1;
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = 1;
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = 1;
dst[11] = 0;
dst[12] = v[0];
dst[13] = v[1];
dst[14] = v[2];
dst[15] = 1;
retur... | javascript | function translation(v, dst) {
dst = dst || new MatType(16);
dst[ 0] = 1;
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = 1;
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = 1;
dst[11] = 0;
dst[12] = v[0];
dst[13] = v[1];
dst[14] = v[2];
dst[15] = 1;
retur... | [
"function",
"translation",
"(",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"1",
";",
"dst",
"[",
"1",
"]",
"=",
"0",
";",
"dst",
"[",
"2",
"]",
"=",
"0",
";",
"dst... | Creates a 4-by-4 matrix which translates by the given vector v.
@param {module:twgl/v3.Vec3} v The vector by
which to translate.
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} The translation matrix.
@memberOf module:twgl/m4 | [
"Creates",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"which",
"translates",
"by",
"the",
"given",
"vector",
"v",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L674-L694 |
8,785 | greggman/twgl.js | src/m4.js | translate | function translate(m, v, dst) {
dst = dst || new MatType(16);
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
const m00 = m[0];
const m01 = m[1];
const m02 = m[2];
const m03 = m[3];
const m10 = m[1 * 4 + 0];
const m11 = m[1 * 4 + 1];
const m12 = m[1 * 4 + 2];
const m13 = m[1 * 4 + 3];
cons... | javascript | function translate(m, v, dst) {
dst = dst || new MatType(16);
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
const m00 = m[0];
const m01 = m[1];
const m02 = m[2];
const m03 = m[3];
const m10 = m[1 * 4 + 0];
const m11 = m[1 * 4 + 1];
const m12 = m[1 * 4 + 2];
const m13 = m[1 * 4 + 3];
cons... | [
"function",
"translate",
"(",
"m",
",",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"v0",
"=",
"v",
"[",
"0",
"]",
";",
"const",
"v1",
"=",
"v",
"[",
"1",
"]",
";",
"const",
"v2",
"=",... | Modifies the given 4-by-4 matrix by translation by the given vector v.
@param {module:twgl/m4.Mat4} m The matrix.
@param {module:twgl/v3.Vec3} v The vector by
which to translate.
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} m once modified.
@member... | [
"Modifies",
"the",
"given",
"4",
"-",
"by",
"-",
"4",
"matrix",
"by",
"translation",
"by",
"the",
"given",
"vector",
"v",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L705-L749 |
8,786 | greggman/twgl.js | src/m4.js | rotateX | function rotateX(m, angleInRadians, dst) {
dst = dst || new MatType(16);
const m10 = m[4];
const m11 = m[5];
const m12 = m[6];
const m13 = m[7];
const m20 = m[8];
const m21 = m[9];
const m22 = m[10];
const m23 = m[11];
const c = Math.cos(angleInRadians);
const s = Math.sin(angleInRadians);
dst... | javascript | function rotateX(m, angleInRadians, dst) {
dst = dst || new MatType(16);
const m10 = m[4];
const m11 = m[5];
const m12 = m[6];
const m13 = m[7];
const m20 = m[8];
const m21 = m[9];
const m22 = m[10];
const m23 = m[11];
const c = Math.cos(angleInRadians);
const s = Math.sin(angleInRadians);
dst... | [
"function",
"rotateX",
"(",
"m",
",",
"angleInRadians",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"m10",
"=",
"m",
"[",
"4",
"]",
";",
"const",
"m11",
"=",
"m",
"[",
"5",
"]",
";",
"const",
... | Modifies the given 4-by-4 matrix by a rotation around the x-axis by the given
angle.
@param {module:twgl/m4.Mat4} m The matrix.
@param {number} angleInRadians The angle by which to rotate (in radians).
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} m... | [
"Modifies",
"the",
"given",
"4",
"-",
"by",
"-",
"4",
"matrix",
"by",
"a",
"rotation",
"around",
"the",
"x",
"-",
"axis",
"by",
"the",
"given",
"angle",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L793-L828 |
8,787 | greggman/twgl.js | src/m4.js | rotateY | function rotateY(m, angleInRadians, dst) {
dst = dst || new MatType(16);
const m00 = m[0 * 4 + 0];
const m01 = m[0 * 4 + 1];
const m02 = m[0 * 4 + 2];
const m03 = m[0 * 4 + 3];
const m20 = m[2 * 4 + 0];
const m21 = m[2 * 4 + 1];
const m22 = m[2 * 4 + 2];
const m23 = m[2 * 4 + 3];
const c = Math.cos... | javascript | function rotateY(m, angleInRadians, dst) {
dst = dst || new MatType(16);
const m00 = m[0 * 4 + 0];
const m01 = m[0 * 4 + 1];
const m02 = m[0 * 4 + 2];
const m03 = m[0 * 4 + 3];
const m20 = m[2 * 4 + 0];
const m21 = m[2 * 4 + 1];
const m22 = m[2 * 4 + 2];
const m23 = m[2 * 4 + 3];
const c = Math.cos... | [
"function",
"rotateY",
"(",
"m",
",",
"angleInRadians",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"m00",
"=",
"m",
"[",
"0",
"*",
"4",
"+",
"0",
"]",
";",
"const",
"m01",
"=",
"m",
"[",
"0"... | Modifies the given 4-by-4 matrix by a rotation around the y-axis by the given
angle.
@param {module:twgl/m4.Mat4} m The matrix.
@param {number} angleInRadians The angle by which to rotate (in radians).
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} m... | [
"Modifies",
"the",
"given",
"4",
"-",
"by",
"-",
"4",
"matrix",
"by",
"a",
"rotation",
"around",
"the",
"y",
"-",
"axis",
"by",
"the",
"given",
"angle",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L872-L907 |
8,788 | greggman/twgl.js | src/m4.js | rotationZ | function rotationZ(angleInRadians, dst) {
dst = dst || new MatType(16);
const c = Math.cos(angleInRadians);
const s = Math.sin(angleInRadians);
dst[ 0] = c;
dst[ 1] = s;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = -s;
dst[ 5] = c;
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = 1;
... | javascript | function rotationZ(angleInRadians, dst) {
dst = dst || new MatType(16);
const c = Math.cos(angleInRadians);
const s = Math.sin(angleInRadians);
dst[ 0] = c;
dst[ 1] = s;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = -s;
dst[ 5] = c;
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = 1;
... | [
"function",
"rotationZ",
"(",
"angleInRadians",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"c",
"=",
"Math",
".",
"cos",
"(",
"angleInRadians",
")",
";",
"const",
"s",
"=",
"Math",
".",
"sin",
"("... | Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.
@param {number} angleInRadians The angle by which to rotate (in radians).
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} The rotation matrix.
@memberOf module:twgl/m4 | [
"Creates",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"which",
"rotates",
"around",
"the",
"z",
"-",
"axis",
"by",
"the",
"given",
"angle",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L916-L940 |
8,789 | greggman/twgl.js | src/m4.js | rotateZ | function rotateZ(m, angleInRadians, dst) {
dst = dst || new MatType(16);
const m00 = m[0 * 4 + 0];
const m01 = m[0 * 4 + 1];
const m02 = m[0 * 4 + 2];
const m03 = m[0 * 4 + 3];
const m10 = m[1 * 4 + 0];
const m11 = m[1 * 4 + 1];
const m12 = m[1 * 4 + 2];
const m13 = m[1 * 4 + 3];
const c = Math.cos... | javascript | function rotateZ(m, angleInRadians, dst) {
dst = dst || new MatType(16);
const m00 = m[0 * 4 + 0];
const m01 = m[0 * 4 + 1];
const m02 = m[0 * 4 + 2];
const m03 = m[0 * 4 + 3];
const m10 = m[1 * 4 + 0];
const m11 = m[1 * 4 + 1];
const m12 = m[1 * 4 + 2];
const m13 = m[1 * 4 + 3];
const c = Math.cos... | [
"function",
"rotateZ",
"(",
"m",
",",
"angleInRadians",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"m00",
"=",
"m",
"[",
"0",
"*",
"4",
"+",
"0",
"]",
";",
"const",
"m01",
"=",
"m",
"[",
"0"... | Modifies the given 4-by-4 matrix by a rotation around the z-axis by the given
angle.
@param {module:twgl/m4.Mat4} m The matrix.
@param {number} angleInRadians The angle by which to rotate (in radians).
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} m... | [
"Modifies",
"the",
"given",
"4",
"-",
"by",
"-",
"4",
"matrix",
"by",
"a",
"rotation",
"around",
"the",
"z",
"-",
"axis",
"by",
"the",
"given",
"angle",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L951-L986 |
8,790 | greggman/twgl.js | src/m4.js | axisRotation | function axisRotation(axis, angleInRadians, dst) {
dst = dst || new MatType(16);
let x = axis[0];
let y = axis[1];
let z = axis[2];
const n = Math.sqrt(x * x + y * y + z * z);
x /= n;
y /= n;
z /= n;
const xx = x * x;
const yy = y * y;
const zz = z * z;
const c = Math.cos(angleInRadians);
con... | javascript | function axisRotation(axis, angleInRadians, dst) {
dst = dst || new MatType(16);
let x = axis[0];
let y = axis[1];
let z = axis[2];
const n = Math.sqrt(x * x + y * y + z * z);
x /= n;
y /= n;
z /= n;
const xx = x * x;
const yy = y * y;
const zz = z * z;
const c = Math.cos(angleInRadians);
con... | [
"function",
"axisRotation",
"(",
"axis",
",",
"angleInRadians",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"let",
"x",
"=",
"axis",
"[",
"0",
"]",
";",
"let",
"y",
"=",
"axis",
"[",
"1",
"]",
";",
"let... | Creates a 4-by-4 matrix which rotates around the given axis by the given
angle.
@param {module:twgl/v3.Vec3} axis The axis
about which to rotate.
@param {number} angleInRadians The angle by which to rotate (in radians).
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {modu... | [
"Creates",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"which",
"rotates",
"around",
"the",
"given",
"axis",
"by",
"the",
"given",
"angle",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L999-L1034 |
8,791 | greggman/twgl.js | src/m4.js | scaling | function scaling(v, dst) {
dst = dst || new MatType(16);
dst[ 0] = v[0];
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = v[1];
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = v[2];
dst[11] = 0;
dst[12] = 0;
dst[13] = 0;
dst[14] = 0;
dst[15] = 1;
return d... | javascript | function scaling(v, dst) {
dst = dst || new MatType(16);
dst[ 0] = v[0];
dst[ 1] = 0;
dst[ 2] = 0;
dst[ 3] = 0;
dst[ 4] = 0;
dst[ 5] = v[1];
dst[ 6] = 0;
dst[ 7] = 0;
dst[ 8] = 0;
dst[ 9] = 0;
dst[10] = v[2];
dst[11] = 0;
dst[12] = 0;
dst[13] = 0;
dst[14] = 0;
dst[15] = 1;
return d... | [
"function",
"scaling",
"(",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"v",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"0",
";",
"dst",
"[",
"2",
"]",
"=",
"... | Creates a 4-by-4 matrix which scales in each dimension by an amount given by
the corresponding entry in the given vector; assumes the vector has three
entries.
@param {module:twgl/v3.Vec3} v A vector of
three entries specifying the factor by which to scale in each dimension.
@param {module:twgl/m4.Mat4} [dst] matrix to... | [
"Creates",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"which",
"scales",
"in",
"each",
"dimension",
"by",
"an",
"amount",
"given",
"by",
"the",
"corresponding",
"entry",
"in",
"the",
"given",
"vector",
";",
"assumes",
"the",
"vector",
"has",
"three",
"entr... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L1120-L1141 |
8,792 | greggman/twgl.js | src/m4.js | scale | function scale(m, v, dst) {
dst = dst || new MatType(16);
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
dst[ 0] = v0 * m[0 * 4 + 0];
dst[ 1] = v0 * m[0 * 4 + 1];
dst[ 2] = v0 * m[0 * 4 + 2];
dst[ 3] = v0 * m[0 * 4 + 3];
dst[ 4] = v1 * m[1 * 4 + 0];
dst[ 5] = v1 * m[1 * 4 + 1];
dst[ 6] = v1 ... | javascript | function scale(m, v, dst) {
dst = dst || new MatType(16);
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
dst[ 0] = v0 * m[0 * 4 + 0];
dst[ 1] = v0 * m[0 * 4 + 1];
dst[ 2] = v0 * m[0 * 4 + 2];
dst[ 3] = v0 * m[0 * 4 + 3];
dst[ 4] = v1 * m[1 * 4 + 0];
dst[ 5] = v1 * m[1 * 4 + 1];
dst[ 6] = v1 ... | [
"function",
"scale",
"(",
"m",
",",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"MatType",
"(",
"16",
")",
";",
"const",
"v0",
"=",
"v",
"[",
"0",
"]",
";",
"const",
"v1",
"=",
"v",
"[",
"1",
"]",
";",
"const",
"v2",
"=",
"... | Modifies the given 4-by-4 matrix, scaling in each dimension by an amount
given by the corresponding entry in the given vector; assumes the vector has
three entries.
@param {module:twgl/m4.Mat4} m The matrix to be modified.
@param {module:twgl/v3.Vec3} v A vector of three entries specifying the
factor by which to scale ... | [
"Modifies",
"the",
"given",
"4",
"-",
"by",
"-",
"4",
"matrix",
"scaling",
"in",
"each",
"dimension",
"by",
"an",
"amount",
"given",
"by",
"the",
"corresponding",
"entry",
"in",
"the",
"given",
"vector",
";",
"assumes",
"the",
"vector",
"has",
"three",
"... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L1154-L1182 |
8,793 | greggman/twgl.js | src/m4.js | transformPoint | function transformPoint(m, v, dst) {
dst = dst || v3.create();
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
const d = v0 * m[0 * 4 + 3] + v1 * m[1 * 4 + 3] + v2 * m[2 * 4 + 3] + m[3 * 4 + 3];
dst[0] = (v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0] + m[3 * 4 + 0]) / d;
dst[1] = (v0 * m[0... | javascript | function transformPoint(m, v, dst) {
dst = dst || v3.create();
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
const d = v0 * m[0 * 4 + 3] + v1 * m[1 * 4 + 3] + v2 * m[2 * 4 + 3] + m[3 * 4 + 3];
dst[0] = (v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0] + m[3 * 4 + 0]) / d;
dst[1] = (v0 * m[0... | [
"function",
"transformPoint",
"(",
"m",
",",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"v3",
".",
"create",
"(",
")",
";",
"const",
"v0",
"=",
"v",
"[",
"0",
"]",
";",
"const",
"v1",
"=",
"v",
"[",
"1",
"]",
";",
"const",
"v2",
"=... | Takes a 4-by-4 matrix and a vector with 3 entries,
interprets the vector as a point, transforms that point by the matrix, and
returns the result as a vector with 3 entries.
@param {module:twgl/m4.Mat4} m The matrix.
@param {module:twgl/v3.Vec3} v The point.
@param {module:twgl/v3.Vec3} dst optional vec3 to store result... | [
"Takes",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"and",
"a",
"vector",
"with",
"3",
"entries",
"interprets",
"the",
"vector",
"as",
"a",
"point",
"transforms",
"that",
"point",
"by",
"the",
"matrix",
"and",
"returns",
"the",
"result",
"as",
"a",
"vect... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L1194-L1206 |
8,794 | greggman/twgl.js | src/m4.js | transformDirection | function transformDirection(m, v, dst) {
dst = dst || v3.create();
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];
dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];
dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v... | javascript | function transformDirection(m, v, dst) {
dst = dst || v3.create();
const v0 = v[0];
const v1 = v[1];
const v2 = v[2];
dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];
dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];
dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v... | [
"function",
"transformDirection",
"(",
"m",
",",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"v3",
".",
"create",
"(",
")",
";",
"const",
"v0",
"=",
"v",
"[",
"0",
"]",
";",
"const",
"v1",
"=",
"v",
"[",
"1",
"]",
";",
"const",
"v2",
... | Takes a 4-by-4 matrix and a vector with 3 entries, interprets the vector as a
direction, transforms that direction by the matrix, and returns the result;
assumes the transformation of 3-dimensional space represented by the matrix
is parallel-preserving, i.e. any combination of rotation, scaling and
translation, but not... | [
"Takes",
"a",
"4",
"-",
"by",
"-",
"4",
"matrix",
"and",
"a",
"vector",
"with",
"3",
"entries",
"interprets",
"the",
"vector",
"as",
"a",
"direction",
"transforms",
"that",
"direction",
"by",
"the",
"matrix",
"and",
"returns",
"the",
"result",
";",
"assu... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/m4.js#L1221-L1233 |
8,795 | greggman/twgl.js | src/attributes.js | createBufferFromTypedArray | function createBufferFromTypedArray(gl, typedArray, type, drawType) {
if (helper.isBuffer(gl, typedArray)) {
return typedArray;
}
type = type || gl.ARRAY_BUFFER;
const buffer = gl.createBuffer();
setBufferFromTypedArray(gl, type, buffer, typedArray, drawType);
return buffer;
} | javascript | function createBufferFromTypedArray(gl, typedArray, type, drawType) {
if (helper.isBuffer(gl, typedArray)) {
return typedArray;
}
type = type || gl.ARRAY_BUFFER;
const buffer = gl.createBuffer();
setBufferFromTypedArray(gl, type, buffer, typedArray, drawType);
return buffer;
} | [
"function",
"createBufferFromTypedArray",
"(",
"gl",
",",
"typedArray",
",",
"type",
",",
"drawType",
")",
"{",
"if",
"(",
"helper",
".",
"isBuffer",
"(",
"gl",
",",
"typedArray",
")",
")",
"{",
"return",
"typedArray",
";",
"}",
"type",
"=",
"type",
"||"... | Given typed array creates a WebGLBuffer and copies the typed array
into it.
@param {WebGLRenderingContext} gl A WebGLRenderingContext
@param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView|WebGLBuffer} typedArray the typed array. Note: If a WebGLBuffer is passed in it will just be returned. No action will be taken
@par... | [
"Given",
"typed",
"array",
"creates",
"a",
"WebGLBuffer",
"and",
"copies",
"the",
"typed",
"array",
"into",
"it",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/attributes.js#L91-L99 |
8,796 | greggman/twgl.js | src/attributes.js | setAttribInfoBufferFromArray | function setAttribInfoBufferFromArray(gl, attribInfo, array, offset) {
array = makeTypedArray(array);
if (offset !== undefined) {
gl.bindBuffer(gl.ARRAY_BUFFER, attribInfo.buffer);
gl.bufferSubData(gl.ARRAY_BUFFER, offset, array);
} else {
setBufferFromTypedArray(gl, gl.ARRAY_BUFFER, attribInfo.buffer... | javascript | function setAttribInfoBufferFromArray(gl, attribInfo, array, offset) {
array = makeTypedArray(array);
if (offset !== undefined) {
gl.bindBuffer(gl.ARRAY_BUFFER, attribInfo.buffer);
gl.bufferSubData(gl.ARRAY_BUFFER, offset, array);
} else {
setBufferFromTypedArray(gl, gl.ARRAY_BUFFER, attribInfo.buffer... | [
"function",
"setAttribInfoBufferFromArray",
"(",
"gl",
",",
"attribInfo",
",",
"array",
",",
"offset",
")",
"{",
"array",
"=",
"makeTypedArray",
"(",
"array",
")",
";",
"if",
"(",
"offset",
"!==",
"undefined",
")",
"{",
"gl",
".",
"bindBuffer",
"(",
"gl",
... | Sets the contents of a buffer attached to an attribInfo
This is helper function to dynamically update a buffer.
Let's say you make a bufferInfo
var arrays = {
position: new Float32Array([0, 0, 0, 10, 0, 0, 0, 10, 0, 10, 10, 0]),
texcoord: new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]),
normal: new Float32Array([0, 0, ... | [
"Sets",
"the",
"contents",
"of",
"a",
"buffer",
"attached",
"to",
"an",
"attribInfo"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/attributes.js#L437-L445 |
8,797 | greggman/twgl.js | src/attributes.js | createBufferFromArray | function createBufferFromArray(gl, array, arrayName) {
const type = arrayName === "indices" ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;
const typedArray = makeTypedArray(array, arrayName);
return createBufferFromTypedArray(gl, typedArray, type);
} | javascript | function createBufferFromArray(gl, array, arrayName) {
const type = arrayName === "indices" ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;
const typedArray = makeTypedArray(array, arrayName);
return createBufferFromTypedArray(gl, typedArray, type);
} | [
"function",
"createBufferFromArray",
"(",
"gl",
",",
"array",
",",
"arrayName",
")",
"{",
"const",
"type",
"=",
"arrayName",
"===",
"\"indices\"",
"?",
"gl",
".",
"ELEMENT_ARRAY_BUFFER",
":",
"gl",
".",
"ARRAY_BUFFER",
";",
"const",
"typedArray",
"=",
"makeTyp... | Creates a buffer from an array, typed array, or array spec
Given something like this
[1, 2, 3],
or
new Uint16Array([1,2,3]);
or
{
data: [1, 2, 3],
type: Uint8Array,
}
returns a WebGLBuffer that constains the given data.
@param {WebGLRenderingContext} gl A WebGLRenderingContext.
@param {module:twgl.ArraySpec} ar... | [
"Creates",
"a",
"buffer",
"from",
"an",
"array",
"typed",
"array",
"or",
"array",
"spec"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/attributes.js#L662-L666 |
8,798 | greggman/twgl.js | src/attributes.js | createBuffersFromArrays | function createBuffersFromArrays(gl, arrays) {
const buffers = { };
Object.keys(arrays).forEach(function(key) {
buffers[key] = createBufferFromArray(gl, arrays[key], key);
});
// Ugh!
if (arrays.indices) {
buffers.numElements = arrays.indices.length;
buffers.elementType = typedArrays.getGLTypeFor... | javascript | function createBuffersFromArrays(gl, arrays) {
const buffers = { };
Object.keys(arrays).forEach(function(key) {
buffers[key] = createBufferFromArray(gl, arrays[key], key);
});
// Ugh!
if (arrays.indices) {
buffers.numElements = arrays.indices.length;
buffers.elementType = typedArrays.getGLTypeFor... | [
"function",
"createBuffersFromArrays",
"(",
"gl",
",",
"arrays",
")",
"{",
"const",
"buffers",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"arrays",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"buffers",
"[",
"key",
"]",
"=",
"cre... | Creates buffers from arrays or typed arrays
Given something like this
var arrays = {
positions: [1, 2, 3],
normals: [0, 0, 1],
}
returns something like
buffers = {
positions: WebGLBuffer,
normals: WebGLBuffer,
}
If the buffer is named 'indices' it will be made an ELEMENT_ARRAY_BUFFER.
@param {WebGLRenderingContex... | [
"Creates",
"buffers",
"from",
"arrays",
"or",
"typed",
"arrays"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/attributes.js#L692-L707 |
8,799 | greggman/twgl.js | src/programs.js | addLineNumbers | function addLineNumbers(src, lineOffset) {
lineOffset = lineOffset || 0;
++lineOffset;
return src.split("\n").map(function(line, ndx) {
return (ndx + lineOffset) + ": " + line;
}).join("\n");
} | javascript | function addLineNumbers(src, lineOffset) {
lineOffset = lineOffset || 0;
++lineOffset;
return src.split("\n").map(function(line, ndx) {
return (ndx + lineOffset) + ": " + line;
}).join("\n");
} | [
"function",
"addLineNumbers",
"(",
"src",
",",
"lineOffset",
")",
"{",
"lineOffset",
"=",
"lineOffset",
"||",
"0",
";",
"++",
"lineOffset",
";",
"return",
"src",
".",
"split",
"(",
"\"\\n\"",
")",
".",
"map",
"(",
"function",
"(",
"line",
",",
"ndx",
"... | eslint-disable-line
Error Callback
@callback ErrorCallback
@param {string} msg error message.
@param {number} [lineOffset] amount to add to line number
@memberOf module:twgl | [
"eslint",
"-",
"disable",
"-",
"line",
"Error",
"Callback"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L457-L464 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.