congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo For Javascript
dynamic
Code IndexAdd Tabnine to your IDE (free)

How to use
dynamic
function

Best JavaScript code snippets using dynamic(Showing top 15 results out of 315)

origin: eggjs/egg

app.beforeStart(function*() {
  // dumpConfig() dynamically
  json = readJSON(path.join(baseDir, 'run/application_config.json'));
  assert(json.config.dynamic === 1, 'should dump in config');
  json = readJSON(path.join(baseDir, 'run/agent_config.json'));
  assert(json.config.dynamic === 0, 'should dump in config');

  yield sleep(2000);
  app.config.dynamic = 2;
 });
origin: o1lab/xmysql

globalRoutesPrint(apiPrefix) {
  let r = [];

  r.push(apiPrefix + "tables");
  r.push(apiPrefix + "xjoin");

  if (this.sqlConfig.dynamic) {
   r.push(apiPrefix + "dynamic");
   r.push("/upload");
   r.push("/uploads");
   r.push("/download");
  }

  return r;
 }
origin: porsager/postgres

function parseRaw(query, str, args = []) {
  const types = []
    , xargs = []

  args.forEach(x => parseValue(x, xargs, types))

  return {
   sig: !query.dynamic && types + str,
   str,
   args: xargs
  }
 }
origin: eggjs/egg

describe('dumpConfig() dynamically', () => {
  let app;
  before(() => {
   app = utils.app('apps/dumpconfig');
  });
  after(() => app.close());

  it('should dump in config', async () => {
   const baseDir = utils.getFilepath('apps/dumpconfig');
   let json;

   await app.ready();

   json = readJson(path.join(baseDir, 'run/application_config.json'));
   assert(json.config.dynamic === 2);
   json = readJson(path.join(baseDir, 'run/agent_config.json'));
   assert(json.config.dynamic === 0);
  });
 });
origin: porsager/postgres

function query(query, connection, xs, args) {
  query.origin = options.debug ? new Error().stack : cachedError(xs)
  query.dynamic = query.dynamic || options.no_prepare
  if (!query.raw && (!Array.isArray(xs) || !Array.isArray(xs.raw)))
   return nested(xs, args)

  const promise = new Promise((resolve, reject) => {
   query.resolve = resolve
   query.reject = reject
   ended !== null
    ? reject(errors.connection('CONNECTION_ENDED', options))
    : ready
     ? send(connection, query, xs, args)
     : fetchArrayTypes(connection).then(() => send(connection, query, xs, args)).catch(reject)
  })

  addMethods(promise, query)

  return promise
 }
origin: gpujs/gpu.js

test('.updateValue() checks too large', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 1 },
  },
  validate: true,
 };
 const v = new webGLKernelValueMaps.single.dynamic["Array1D(2)"]([[1,2]], {
  kernel: mockKernel,
  name: 'test',
  type: 'Array1D(2)',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });

 assert.throws(() => {
  v.updateValue([[1,2],[3,4],[5,6],[7,8]]);
 }, new Error('Argument texture height of 2 larger than maximum size of 1 for your GPU'));
});
origin: porsager/postgres

function parse(query, xs, args = []) {
  const xargs = []
    , types = []

  let str = xs[0]
  let arg

  for (let i = 1; i < xs.length; i++) {
   arg = args[i - 1]
   str += parseArg(str, arg, xargs, types) + xs[i]
  }

  return {
   sig: !query.dynamic && !xargs.dynamic && types + str,
   str: str.trim(),
   args: xargs
  }
 }
origin: gpujs/gpu.js

test('.updateValue() checks too large', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 2 },
  },
  validate: true,
 };
 const v = new webGLKernelValueMaps.unsigned.dynamic.Array([1,2], {
  kernel: mockKernel,
  name: 'test',
  type: 'Array',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });

 assert.throws(() => {
  v.updateValue(new Array([1,2,3,4,5,6,7,8]));
 }, new Error('Argument texture width of 4 larger than maximum size of 2 for your GPU'));
});
origin: gpujs/gpu.js

test('.updateValue() checks too large height', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 4 },
  },
  validate: true,
 };
 const v = new webGL2KernelValueMaps.single.dynamic.Input({ size: [5, 5], value: [0] }, {
  kernel: mockKernel,
  name: 'test',
  type: 'Input',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });

 assert.throws(() => {
  v.updateValue({ size: [16,16] });
 }, new Error('Argument texture height and width of 8 larger than maximum size of 4 for your GPU'));
});
origin: gpujs/gpu.js

test('.updateValue() checks too large height', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 1 },
  },
  validate: true,
 };
 const v = new webGL2KernelValueMaps.unsigned.dynamic.HTMLImageArray([{ width: 1, height: 1 }], {
  kernel: mockKernel,
  name: 'test',
  type: 'HTMLImage',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });

 assert.throws(() => {
  v.updateValue([{ width: 1, height: 2 }]);
 }, new Error('Argument texture height of 2 larger than maximum size of 1 for your GPU'));
});
origin: gpujs/gpu.js

test('.updateValue() checks too large', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 1 },
  },
  validate: true,
 };
 const v = new webGL2KernelValueMaps.single.dynamic.Array([1,2], {
  kernel: mockKernel,
  name: 'test',
  type: 'Array',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });

 assert.throws(() => {
  v.updateValue(new Array([1,2,3,4,5,6,7,8]));
 }, new Error('Argument texture height of 2 larger than maximum size of 1 for your GPU'));
});
origin: gpujs/gpu.js

test('.updateValue() checks too large width', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 1 },
  },
  validate: true,
 };

 const v = new webGLKernelValueMaps.single.dynamic.Input({ size: [1, 1], value: [0] }, {
  kernel: mockKernel,
  name: 'test',
  type: 'Input',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });
 assert.throws(() => {
  v.updateValue({
   size: [3,3]
  })
 }, new Error('Argument texture width of 3 larger than maximum size of 1 for your GPU'));
});
origin: gpujs/gpu.js

test('.updateValue() checks too large width', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 4 },
  },
  validate: true,
 };

 const v = new webGL2KernelValueMaps.single.dynamic.Input({ size: [1, 1], value: [0] }, {
  kernel: mockKernel,
  name: 'test',
  type: 'Input',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });
 assert.throws(() => {
  v.updateValue({
   size: [12,12]
  })
 }, new Error('Argument texture height and width of 6 larger than maximum size of 4 for your GPU'));
});
origin: gpujs/gpu.js

test('.updateValue() checks too large', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 1 },
  },
  validate: true,
 };
 const v = new webGLKernelValueMaps.single.dynamic["Array2D(2)"]([[[1,2]]], {
  kernel: mockKernel,
  name: 'test',
  type: 'Array2D(2)',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });

 assert.throws(() => {
  v.updateValue([[[1,2],[3,4],[5,6],[7,8]]]);
 }, new Error('Argument texture height of 2 larger than maximum size of 1 for your GPU'));
});
origin: gpujs/gpu.js

test('.updateValue() checks too large', () => {
 const mockKernel = {
  constructor: {
   features: { maxTextureSize: 1 },
  },
  validate: true,
 };
 const v = new webGLKernelValueMaps.single.dynamic["Array3D(2)"]([[[[1,2]]]], {
  kernel: mockKernel,
  name: 'test',
  type: 'Array3D(2)',
  origin: 'user',
  tactic: 'speed',
  onRequestContextHandle: () => 1,
  onRequestTexture: () => null,
  onRequestIndex: () => 1
 });

 assert.throws(() => {
  v.updateValue([[[[1,2],[3,4],[5,6],[7,8]]]]);
 }, new Error('Argument texture height of 2 larger than maximum size of 1 for your GPU'));
});
dynamic

Popular in JavaScript

  • js-yaml
    YAML 1.2 parser and serializer
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • colors
    get colors in your node.js console
  • glob
    a little globber
  • lodash
    Lodash modular utilities.
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • winston
    A logger for just about everything.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now