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

How to use
TinyEmitter
in
tiny-emitter

Best JavaScript code snippets using tiny-emitter.TinyEmitter(Showing top 3 results out of 315)

origin: birkir/react-three-fiber-examples

useCallback((event, hits) => {
  state.current.pointer.emit('pointerCancel', event);
  if (!hits) hits = handleIntersects(event, () => null);
  Array.from(hovered.values()).forEach(data => {
   if (hits && (!hits.length || !hits.find(i => i.object === data.object))) {
    const object = data.object;
    const handlers = object.__handlers;
    if (handlers && handlers.pointerOut) handlers.pointerOut(_extends({}, data, {
     type: 'pointerout'
    }));
    hovered.delete(makeId(data));
   }
  });
 }, [])
origin: birkir/react-three-fiber-examples

useCallback(name => event => {
  state.current.pointer.emit(name, event); // Collect hits

  const hits = handleIntersects(event, data => {
   const object = data.object;
   const handlers = object.__handlers;

   if (handlers && handlers[name]) {
    // Forward all events back to their respective handlers with the exception of click,
    // which must must the initial target
    if (name !== 'click' || state.current.initialHits.includes(object)) handlers[name](data);
   }
  }); // If a click yields no results, pass it back to the user as a miss

  if (name === 'pointerDown') {
   state.current.initialClick = [event.clientX, event.clientY];
   state.current.initialHits = hits.map(hit => hit.object);
  }

  if (name === 'click' && !hits.length && onPointerMissed) {
   let dx = event.clientX - state.current.initialClick[0];
   let dy = event.clientY - state.current.initialClick[1];
   let distance = Math.round(Math.sqrt(dx * dx + dy * dy));
   if (distance <= 2) onPointerMissed();
  }
 }, [onPointerMissed])
origin: birkir/react-three-fiber-examples

useCallback(event => {
  state.current.pointer.emit('pointerMove', event);
  const hits = handleIntersects(event, data => {
   const object = data.object;
tiny-emitter(npm)TinyEmitter

Most used tiny-emitter functions

  • EventEmitter.emit
  • TinyEmitter.emit

Popular in JavaScript

  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • js-yaml
    YAML 1.2 parser and serializer
  • lodash
    Lodash modular utilities.
  • chalk
    Terminal string styling done right
  • fs
  • postcss
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • mime-types
    The ultimate javascript content-type utility.
  • debug
    small debugging utility
  • Best plugins for Eclipse
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