How to use the fbemitter.EventEmitter function in fbemitter

To help you get started, we’ve selected a few fbemitter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AndroConsis / Food-Delivery-App / components / PastOrders.js View on Github external
import React, { Component } from 'react';
import { 
		 ListView,
		 StyleSheet, 
		 TouchableOpacity, 
		 Text,
		 View,
		} from 'react-native';

import styles from '../styles/menu';

import { Toolbar } from 'react-native-material-design';

import { EventEmitter } from 'fbemitter';

let _emitter = new EventEmitter();

// A particular View Component
class PastOrders extends Component {

// rendering Veiw
	render() {
		return (
			
		);
	}
github AndroConsis / Food-Delivery-App / components / Notifications.js View on Github external
'use strict'

import React, { Component } from 'react';
import { 
		 StyleSheet, 
		 TouchableOpacity, 
		 Text,
		 View,
		} from 'react-native';

import styles from '../styles/menu';
import { Toolbar } from 'react-native-material-design';

import { EventEmitter } from 'fbemitter';

let _emitter = new EventEmitter();

// A particular View Component
class Notifications extends Component {

	constructor(props) {
	  super(props);
	
	  this.state = {};
	}

// rendering Veiw
	render() {
		return (
github NCI-GDC / portal-ui / src / packages / @ncigdc / utils / emitter.js View on Github external
// @flow
import { EventEmitter } from 'fbemitter';

const emitter = new EventEmitter();

export default emitter;
github DefinitelyTyped / DefinitelyTyped / types / fbemitter / fbemitter-tests.ts View on Github external
it('returns an array of function', function () {
             var e = new EventEmitter();

             function foo() {}

             e.addListener('foo', foo);
             assert.strictEqual(e.listeners('foo') instanceof Array, true);
             assert.strictEqual(e.listeners('foo').length, 1);
             console.log(e.listeners('foo')[0]);
             assert.strictEqual(e.listeners('foo')[0], foo);
        });
github DefinitelyTyped / DefinitelyTyped / types / fbemitter / fbemitter-tests.ts View on Github external
it('emits to all event listeners', function () {
            var e = new EventEmitter()
                , pattern: string[] = [];

            e.addListener('foo', function () {
                pattern.push('foo1');
            });

            e.addListener('foo', function () {
                pattern.push('foo2');
            });

            e.emit('foo');

            assert.strictEqual(pattern.join(';'), 'foo1;foo2');
        });
github DefinitelyTyped / DefinitelyTyped / types / fbemitter / fbemitter-tests.ts View on Github external
it('emits with different contexts', function () {
            var e = new EventEmitter()
                , pattern = '';

            function writer() {
                pattern += this;
            }

            e.addListener('write', writer, 'foo');
            e.addListener('write', writer, 'baz');
            e.once('write', writer, 'bar');
            e.once('write', writer, 'banana');

            e.emit('write');
            assert.strictEqual(pattern, 'foobazbarbanana');
        });
github DefinitelyTyped / DefinitelyTyped / types / fbemitter / fbemitter-tests.ts View on Github external
it('emits with context', function (done) {
            var context = { bar: 'baz' }
                , e = new EventEmitter();

            e.addListener('foo', function (bar: string) {
                assert.strictEqual(bar, 'bar');
                assert.strictEqual(this, context);

                done();
            }, context);

            e.emit('foo', 'bar');
        });
github appbaseio / dashboard / src / shared / helper.js View on Github external
import { appbaseService } from '../service/AppbaseService';
import { AppOwner } from '../shared/SharedComponents';

const { EventEmitter } = require('fbemitter');

const eventEmitter = new EventEmitter();

class AppDashboard {
	constructor() {
		this.allowedView = ['dashboard', 'search-sandbox', 'browser', 'mappings', 'builder', 'credentials', 'team', 'analytics'];
	}
	onEnter(activeApp, currentView) {
		const appObj = {
			activeApp,
			currentView,
		};
		appbaseService.setExtra('nav', appObj);
		eventEmitter.emit('activeApp', appObj);
		localStorage.setItem('appbaseDashboardApp', activeApp);
	}
	onLeave() {
		eventEmitter.emit('activeApp', {
github appbaseio / dashboard / src / shared / helper.js View on Github external
const { EventEmitter } = require('fbemitter');

const eventEmitter = new EventEmitter();
import { appbaseService } from '../service/AppbaseService';
import { AppOwner } from '../shared/SharedComponents';

class AppDashboard {
	constructor() {
		this.allowedView = ['dashboard', 'browser', 'mappings', 'builder', 'credentials', 'team'];
	}
	onEnter(activeApp, currentView) {
		const appObj = {
			activeApp,
			currentView,
		};
		appbaseService.setExtra('nav', appObj);
		eventEmitter.emit('activeApp', appObj);
		localStorage.setItem('appbaseDashboardApp', activeApp);
	}
github expo / expo / packages / expo / src / Updates / Updates.ts View on Github external
function _getEmitter(): EventEmitter {
  if (!_emitter) {
    _emitter = new EventEmitter();
    DeviceEventEmitter.addListener('Exponent.nativeUpdatesEvent', _emitEvent);
  }
  return _emitter;
}

fbemitter

Facebook's EventEmitter is a simple emitter implementation that prioritizes speed and simplicity. It is conceptually similar to other emitters like Node's EventEmitter, but the precise APIs differ. More complex abstractions like the event systems used on

BSD-3-Clause
Latest version published 4 years ago

Package Health Score

64 / 100
Full package analysis

Popular fbemitter functions