Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 (
);
}
'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 (
// @flow
import { EventEmitter } from 'fbemitter';
const emitter = new EventEmitter();
export default emitter;
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);
});
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');
});
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');
});
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');
});
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', {
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);
}
function _getEmitter(): EventEmitter {
if (!_emitter) {
_emitter = new EventEmitter();
DeviceEventEmitter.addListener('Exponent.nativeUpdatesEvent', _emitEvent);
}
return _emitter;
}