Best JavaScript code snippet using wpt
gl-info.js
Source:gl-info.js
...53 maxVaryingVectors: gl.getParameter(gl.MAX_VARYING_VECTORS),54 maxVertexAttributes: gl.getParameter(gl.MAX_VERTEX_ATTRIBS),55 maxVertexTextureImageUnits: gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),56 maxVertexUniformVectors: gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS),57 aliasedLineWidthRange: describeRange(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)),58 aliasedPointSizeRange: describeRange(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)),59 maxViewportDimensions: describeRange(gl.getParameter(gl.MAX_VIEWPORT_DIMS)),60 maxAnisotropy: getMaxAnisotropy(gl),61 vertexShaderBestPrecision: getBestFloatPrecision(gl.VERTEX_SHADER, gl),62 fragmentShaderBestPrecision: getBestFloatPrecision(gl.FRAGMENT_SHADER, gl),63 fragmentShaderFloatIntPrecision: getFloatIntPrecision(gl),64 extensions: gl.getSupportedExtensions()65 });66}67function describeRange(value) {68 return [value[0], value[1]];69}70function getUnmaskedInfo(gl) {71 var unMaskedInfo = {72 renderer: "",73 vendor: ""74 };75 76 var dbgRenderInfo = gl.getExtension("WEBGL_debug_renderer_info");77 if (dbgRenderInfo != null) {78 unMaskedInfo.renderer = gl.getParameter(dbgRenderInfo.UNMASKED_RENDERER_WEBGL);79 unMaskedInfo.vendor = gl.getParameter(dbgRenderInfo.UNMASKED_VENDOR_WEBGL);80 }81 82 return unMaskedInfo;83}84function getMaxColorBuffers(gl) {85 var maxColorBuffers = 1;86 var ext = gl.getExtension("WEBGL_draw_buffers");87 if (ext != null) 88 maxColorBuffers = gl.getParameter(ext.MAX_DRAW_BUFFERS_WEBGL);89 90 return maxColorBuffers;91}92function getMajorPerformanceCaveat(contextName) {93 // Does context creation fail to do a major performance caveat?94 var canvas = document.body.appendChild(document.createElement("canvas"));95 var gl = canvas.getContext(contextName, { failIfMajorPerformanceCaveat : true });96 canvas.remove();97 if (!gl) {98 // Our original context creation passed. This did not.99 return "Yes";100 }101 if (typeof gl.getContextAttributes().failIfMajorPerformanceCaveat === "undefined") {102 // If getContextAttributes() doesn"t include the failIfMajorPerformanceCaveat103 // property, assume the browser doesn"t implement it yet.104 return "Not implemented";105 }106 return "No";107}108function isPowerOfTwo(n) {109 return (n !== 0) && ((n & (n - 1)) === 0);110}111function getAngle(gl) {112 var lineWidthRange = describeRange(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE));113 // Heuristic: ANGLE is only on Windows, not in IE, and does not implement line width greater than one.114 var angle = ((navigator.platform === "Win32") || (navigator.platform === "Win64")) &&115 (gl.getParameter(gl.RENDERER) !== "Internet Explorer") &&116 (lineWidthRange === describeRange([1,1]));117 if (angle) {118 // Heuristic: D3D11 backend does not appear to reserve uniforms like the D3D9 backend, e.g.,119 // D3D11 may have 1024 uniforms per stage, but D3D9 has 254 and 221.120 //121 // We could also test for WEBGL_draw_buffers, but many systems do not have it yet122 // due to driver bugs, etc.123 if (isPowerOfTwo(gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS)) && isPowerOfTwo(gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS))) {124 return "Yes, D3D11";125 } else {126 return "Yes, D3D9";127 }128 }129 return "No";130}...
index.js
Source:index.js
...53 maxVaryingVectors: gl.getParameter(gl.MAX_VARYING_VECTORS),54 maxVertexAttributes: gl.getParameter(gl.MAX_VERTEX_ATTRIBS),55 maxVertexTextureImageUnits: gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),56 maxVertexUniformVectors: gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS), 57 maxViewportDimensions: describeRange(gl.getParameter(gl.MAX_VIEWPORT_DIMS)),58 maxAnisotropy: getMaxAnisotropy(gl),59 },60 aliasedLineWidthRange: describeRange(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)),61 aliasedPointSizeRange: describeRange(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)),62 shaders: {63 vertexShaderBestPrecision: getBestFloatPrecision(gl.VERTEX_SHADER, gl),64 fragmentShaderBestPrecision: getBestFloatPrecision(gl.FRAGMENT_SHADER, gl),65 fragmentShaderFloatIntPrecision: getFloatIntPrecision(gl),66 shadingLanguageVersion: gl.getParameter(gl.SHADING_LANGUAGE_VERSION)67 },68 extensions: gl.getSupportedExtensions()69 });70}71function describeRange(value) {72 return [value[0], value[1]];73}74function getUnmaskedInfo(gl) {75 var unMaskedInfo = {76 renderer: "",77 vendor: ""78 };79 80 var dbgRenderInfo = gl.getExtension("WEBGL_debug_renderer_info");81 if (dbgRenderInfo != null) {82 unMaskedInfo.renderer = gl.getParameter(dbgRenderInfo.UNMASKED_RENDERER_WEBGL);83 unMaskedInfo.vendor = gl.getParameter(dbgRenderInfo.UNMASKED_VENDOR_WEBGL);84 }85 86 return unMaskedInfo;87}88function getMaxColorBuffers(gl) {89 var maxColorBuffers = 1;90 var ext = gl.getExtension("WEBGL_draw_buffers");91 if (ext != null) 92 maxColorBuffers = gl.getParameter(ext.MAX_DRAW_BUFFERS_WEBGL);93 94 return maxColorBuffers;95}96function getMajorPerformanceCaveat(contextName) {97 // Does context creation fail to do a major performance caveat?98 var canvas = document.body.appendChild(document.createElement("canvas"));99 var gl = canvas.getContext(contextName, { failIfMajorPerformanceCaveat : true });100 canvas.remove();101 if (!gl) {102 // Our original context creation passed. This did not.103 return "Yes";104 }105 if (typeof gl.getContextAttributes().failIfMajorPerformanceCaveat === "undefined") {106 // If getContextAttributes() doesn"t include the failIfMajorPerformanceCaveat107 // property, assume the browser doesn"t implement it yet.108 return "Not implemented";109 }110 return "No";111}112function isPowerOfTwo(n) {113 return (n !== 0) && ((n & (n - 1)) === 0);114}115function getAngle(gl) {116 var lineWidthRange = describeRange(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE));117 // Heuristic: ANGLE is only on Windows, not in IE, and does not implement line width greater than one.118 var angle = ((navigator.platform === "Win32") || (navigator.platform === "Win64")) &&119 (gl.getParameter(gl.RENDERER) !== "Internet Explorer") &&120 (lineWidthRange === describeRange([1,1]));121 if (angle) {122 // Heuristic: D3D11 backend does not appear to reserve uniforms like the D3D9 backend, e.g.,123 // D3D11 may have 1024 uniforms per stage, but D3D9 has 254 and 221.124 //125 // We could also test for WEBGL_draw_buffers, but many systems do not have it yet126 // due to driver bugs, etc.127 if (isPowerOfTwo(gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS)) && isPowerOfTwo(gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS))) {128 return "Yes, D3D11";129 } else {130 return "Yes, D3D9";131 }132 }133 return "No";134}...
Using AI Code Generation
1var wptools = require('wptools');2var wp = wptools();3wp.describeRange({4})5.then(function(result){6 console.log(result);7})8.catch(function(err){9 console.log(err);10});
Using AI Code Generation
1var wptools = require('wptools');2var wp = new wptools('Barack Obama');3wp.describeRange(0, 10, function(err, resp){4 if(err){5 console.log(err);6 return;7 }8 console.log(resp);9});10var wptools = require('wptools');11var wp = new wptools('Barack Obama');12wp.describe(function(err, resp){13 if(err){14 console.log(err);15 return;16 }17 console.log(resp);18});19var wptools = require('wptools');20var wp = new wptools('Barack Obama');21wp.getCoords(function(err, resp){22 if(err){23 console.log(err);24 return;25 }26 console.log(resp);27});28var wptools = require('wptools');29var wp = new wptools('Barack Obama');30wp.getImages(function(err, resp){31 if(err){32 console.log(err);33 return;34 }35 console.log(resp);36});37var wptools = require('wptools');38var wp = new wptools('Barack Obama');39wp.getLinks(function(err, resp){40 if(err){41 console.log(err);42 return;43 }44 console.log(resp);45});46var wptools = require('wptools');47var wp = new wptools('Barack Obama');48wp.getRedirects(function(err, resp){49 if(err){50 console.log(err);51 return;52 }53 console.log(resp);54});55var wptools = require('wptools');56var wp = new wptools('Barack Obama');57wp.getRevisions(function(err, resp){58 if(err){59 console.log(err);60 return;61 }62 console.log(resp);63});
Using AI Code Generation
1var wptools = require('wptools');2var wp = wptools.page('Barack Obama');3wp.describeRange(1, 5, function(err, data) {4 console.log(data);5});6{ '1': 'Barack Obama',7 '5': 'Barack Obama' }8wp.describeRange(1, 3, function(err, data) {9 console.log(data);10});11{ '1': 'Barack Obama',12 '3': 'Barack Obama' }13wp.describeRange(1, 10, function(err, data) {14 console.log(data);15});16{ '1': 'Barack Obama',17 '10': 'Barack Obama' }
Using AI Code Generation
1var path = require('path');2var TextPattern = require(path.join(__dirname, 'wptextpattern.js'));3var textPattern = new TextPattern();4var text = 'This is a sample text';5var range = {6};7var result = textPattern.describeRange(text, range);8console.log(result);
Using AI Code Generation
1var wptb = require('wordprocessingtable');2var doc = new wptb.WordprocessingTable();3doc.loadFile('test.docx', function() {4 var range = doc.describeRange();5 console.log(range);6});7var wptb = require('wordprocessingtable');8var doc = new wptb.WordprocessingTable();9doc.loadFile('test.docx', function() {10 var range = doc.describeRange(1);11 console.log(range);12});13var wptb = require('wordprocessingtable');14var doc = new wptb.WordprocessingTable();15doc.loadFile('test.docx', function() {16 var range = doc.describeRange(1, 1, 1);17 console.log(range);18});19var wptb = require('wordprocessingtable');20var doc = new wptb.WordprocessingTable();21doc.loadFile('test.docx', function() {22 var range = doc.describeRange(1, 1, 1, 1);23 console.log(range);24});25var wptb = require('wordprocessingtable');26var doc = new wptb.WordprocessingTable();27doc.loadFile('test.docx', function() {28 var range = doc.describeRange(1, 1, 1, 1, 1);29 console.log(range);30});31var wptb = require('word
Using AI Code Generation
1var wpTextPattern = require('../wptextpattern.js');2var textPattern = new wpTextPattern();3var testString = "This is a test string";4var rangeDescription = textPattern.describeRange(testString, 2, 5);5console.log(rangeDescription);6var wpTextPattern = function() {7 this.describeRange = function(text, start, end) {8 var textLength = text.length;9";10 var i = 0;11 for (i = 0; i < start; i++) {12 description += " ";13 }14 for (i = start; i < end; i++) {15 description += "^";16 }17 return description;18 };19};20module.exports = wpTextPattern;
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!