Tabnine Logo For Javascript
tiny-emitter
Code IndexAdd Tabnine to your IDE (free)

How to use tiny-emitter

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

origin: Workshape/mandi

/**
 * Set current user to given value
 *
 * @param  {Object|void} user
 * @return {void}
 */
function setUser(value = null) {
 let changedState

 if (!!user !== !!value) { changedState = true }

 user = value

 app.set('user', user)
 events.emit('change', user)
 if (changedState) { events.emit('change-state', changedState) }
}
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)

Most used tiny-emitter functions

  • EventEmitter.emit
  • TinyEmitter.emit

Popular in JavaScript

  • postcss
  • semver
    The semantic version parser used by npm.
  • mime-types
    The ultimate javascript content-type utility.
  • moment
    Parse, validate, manipulate, and display dates
  • async
    Higher-order functions and common patterns for asynchronous code
  • lodash
    Lodash modular utilities.
  • redis
    Redis client library
  • aws-sdk
    AWS SDK for JavaScript
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • Top Sublime Text plugins
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