Codota Logo For Javascript
Array.instances
Code IndexAdd Codota to your IDE (free)

How to use
instances
function
in
Array

Best JavaScript code snippets using builtins.Array.instances(Showing top 8 results out of 315)

origin: opentok/opentok-rtc

Opentok.instances.forEach((instance) => {
  instance._sinonRestore();
 });
origin: ptoner/freedom-for-data-client

function setup(e){function n(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function t(e){let o;function i(...e){if(!i.enabled)return;const n=i,s=Number(new Date),r=s-(o||s);n.diff=r,n.prev=o,n.curr=s,o=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(s,r)=>{if("%%"===s)return s;a++;const o=t.formatters[r];if("function"==typeof o){const t=e[a];s=o.call(n,t),e.splice(a,1),a--}return s}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return i.namespace=e,i.enabled=t.enabled(e),i.useColors=t.useColors(),i.color=n(e),i.destroy=s,i.extend=r,"function"==typeof t.init&&t.init(i),t.instances.push(i),i}function s(){const e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}function r(e,n){return t(this.namespace+(void 0===n?":":n)+e)}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(o),...t.skips.map(o).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),r=s.length;for(n=0;n<r;n++)s[n]&&("-"===(e=s[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){const e=t.instances[n];e.enabled=t.enabled(e.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,s;for(n=0,s=t.skips.length;n<s;n++)if(t.skips[n].test(e))return!1;for(n=0,s=t.names.length;n<s;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=require("ms"),Object.keys(e).forEach(n=>{t[n]=e[n]}),t.instances=[],t.names=[],t.skips=[],t.formatters={},t.selectColor=n,t.enable(t.load()),t}
origin: usegraffy/graffy

constructor() {
  MockWebSocket.instances.push(this);
 }
origin: usegraffy/graffy

 MockWebSocket.instances.splice(0);
 global.WebSocket = MockWebSocket;
 socket = new Socket('ws://localhost:3684');
 ws = MockWebSocket.instances[0];
});
 expect(MockWebSocket.instances.length).toBe(1);
});
 ws.onclose();
 jest.advanceTimersByTime(1490);
 expect(MockWebSocket.instances.length).toBe(1);
 jest.advanceTimersByTime(20);
 expect(MockWebSocket.instances.length).toBe(2);
});
 ws.onclose();
 jest.advanceTimersByTime(1490);
 expect(MockWebSocket.instances.length).toBe(1);
 jest.advanceTimersByTime(20);
 expect(MockWebSocket.instances.length).toBe(2);
});
 jest.advanceTimersByTime(11000); // Connection needs to be stable for 10s
 ws.onmessage({ data: '[":ping"]' });
 expect(MockWebSocket.instances.length).toBe(1);
 ws.onclose();
 expect(MockWebSocket.instances.length).toBe(2);
});
origin: opentok/opentok-rtc

Opentok.instances.push(opentok);
origin: brainfoolong/web-ftp-client

self.id = WebSocketUser.instances.length
WebSocketUser.instances.push(self)
 WebSocketUser.instances.splice(self.id, 1)
 self.socket = null
 self.userData = null
origin: usegraffy/graffy

constructor() {
  MockWebSocket.instances.push(this);
 }
origin: usegraffy/graffy

 MockWebSocket.instances.splice(0);
 global.WebSocket = MockWebSocket;
 socket = new Socket('ws://localhost:3684');
 ws = MockWebSocket.instances[0];
});
 expect(MockWebSocket.instances.length).toBe(1);
});
 ws.onclose();
 jest.advanceTimersByTime(1490);
 expect(MockWebSocket.instances.length).toBe(1);
 jest.advanceTimersByTime(20);
 expect(MockWebSocket.instances.length).toBe(2);
});
 ws.onclose();
 jest.advanceTimersByTime(1490);
 expect(MockWebSocket.instances.length).toBe(1);
 jest.advanceTimersByTime(20);
 expect(MockWebSocket.instances.length).toBe(2);
});
 jest.advanceTimersByTime(11000); // Connection needs to be stable for 10s
 ws.onmessage({ data: '[":ping"]' });
 expect(MockWebSocket.instances.length).toBe(1);
 ws.onclose();
 expect(MockWebSocket.instances.length).toBe(2);
});
builtins(MDN)Arrayinstances

Most used builtins functions

  • Console.log
  • Console.error
  • Promise.then
    Attaches callbacks for the resolution and/or rejection of the Promise.
  • Promise.catch
    Attaches a callback for only the rejection of the Promise.
  • Array.push
    Appends new elements to an array, and returns the new length of the array.
  • Array.length,
  • Array.map,
  • String.indexOf,
  • fetch,
  • Window.location,
  • Window.addEventListener,
  • ObjectConstructor.keys,
  • Array.forEach,
  • Location.reload,
  • Response.status,
  • Navigator.serviceWorker,
  • ServiceWorkerContainer.register,
  • ServiceWorkerRegistration.installing,
  • ServiceWorkerContainer.controller

Popular in JavaScript

  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • colors
    get colors in your node.js console
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • moment
    Parse, validate, manipulate, and display dates
  • mongodb
    The official MongoDB driver for Node.js
  • chalk
    Terminal string styling done right
  • winston
    A logger for just about everything.
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • ms
    Tiny millisecond conversion utility
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now