Codota Logo For Javascript
tiny-emitter
Code IndexAdd Codota 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

  • commander
    the complete solution for node.js command-line programs
  • aws-sdk
    AWS SDK for JavaScript
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • js-yaml
    YAML 1.2 parser and serializer
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • winston
    A logger for just about everything.
  • debug
    small debugging utility
  • lodash
    Lodash modular utilities.
  • 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