当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript EventEmitter.call方法代码示例

本文整理汇总了TypeScript中events.EventEmitter.call方法的典型用法代码示例。如果您正苦于以下问题:TypeScript EventEmitter.call方法的具体用法?TypeScript EventEmitter.call怎么用?TypeScript EventEmitter.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在events.EventEmitter的用法示例。


在下文中一共展示了EventEmitter.call方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: TwitterWatcher

function TwitterWatcher() {
    if (!(this instanceof TwitterWatcher)) {
        return new TwitterWatcher();
    }

    events.EventEmitter.call(this);
}
开发者ID:toastermagic,项目名称:plaques,代码行数:7,代码来源:index.ts

示例2: Updater

function Updater(time) {
    this.time = time;
    this.array = [
        {number: 1},
        {number: 2}
    ];
    var that;
    events.EventEmitter.call(this);

    this.init = function()
    {
        that = this;
        console.log("Contructor");
        //Start interval
        setInterval(that.run,that.time);
    };

    this.run = function()
    {
        that.array.forEach(function (item) {
           if(item.number === 2)
           {
               that.emit('Event');
           }
        });
    };
}
开发者ID:MattGauler,项目名称:support-portal-uat,代码行数:27,代码来源:updater.ts

示例3: constructor

	constructor(filename: string) {
		super();
		EventEmitter.call(this);
		this.filename = filename;
		this.stack = [];
		this.paused = false;
	}
开发者ID:freezy,项目名称:node-vpdb,代码行数:7,代码来源:xml.parser.ts

示例4: function

export var OrderBook = function(productID: string, websocketURI: string, restURI: string, timeProvider: Utils.ITimeProvider) {
    var self = this;
    EventEmitter.call(self);

    self.productID = productID || 'BTC-USD';
    self.websocketURI = websocketURI || 'wss://ws-feed.exchange.coinbase.com';
    self.restURI = restURI;
    self.state = self.STATES.closed;
    self.fail_count = 0;
    self.timeProvider = timeProvider;
    self.connect();
};
开发者ID:Camille92,项目名称:tribeca,代码行数:12,代码来源:coinbase-api.ts

示例5: creator

    module[method] = (...args: any) => {
      // create new instance of module at runtime if none exists
      if (!lazyModule) {
        lazyModule = creator()
        if (isEventEmitter) EventEmitter.call(lazyModule as any)
      }

      // check for properties on the prototype chain that aren't functions
      if (typeof (lazyModule as any)[method] !== 'function') {
        return (lazyModule as any)[method]
      }

      return (lazyModule as any)[method](...args)
    }
开发者ID:doridoridoriand,项目名称:electron,代码行数:14,代码来源:utils.ts

示例6: function

var VirtualSerialPort = function(path, options, callback) {
    events.EventEmitter.call(this);

    console.log("on virtual port ", path);

    this.path = path;
    var self = this;

    this.writeToComputer = function(data) {
        self.emit("data", data);
    };

    if (options.autoOpen) {
        process.nextTick(function() {
            self.open(callback);
        });
    }
     
};
开发者ID:nodesense,项目名称:nodesense-modbus-serial,代码行数:19,代码来源:virtual-serialport.ts

示例7: setApplicationMenu

import { EventEmitter } from 'events'

const bindings = process.atomBinding('app')
const commandLine = process.atomBinding('command_line')
const { app, App } = bindings

// Only one app object permitted.
export default app

const { deprecate, Menu } = electron

let dockMenu: Electron.Menu | null = null

// App is an EventEmitter.
Object.setPrototypeOf(App.prototype, EventEmitter.prototype)
EventEmitter.call(app as any)

Object.assign(app, {
  setApplicationMenu (menu: Electron.Menu | null) {
    return Menu.setApplicationMenu(menu)
  },
  getApplicationMenu () {
    return Menu.getApplicationMenu()
  },
  commandLine: {
    hasSwitch: (theSwitch: string) => commandLine.hasSwitch(String(theSwitch)),
    getSwitchValue: (theSwitch: string) => commandLine.getSwitchValue(String(theSwitch)),
    appendSwitch: (theSwitch: string, value?: string) => commandLine.appendSwitch(String(theSwitch), typeof value === 'undefined' ? value : String(value)),
    appendArgument: (arg: string) => commandLine.appendArgument(String(arg))
  } as Electron.CommandLine,
  enableMixedSandbox () {
开发者ID:vwvww,项目名称:electron,代码行数:31,代码来源:app.ts

示例8: Sound

module.exports = function Sound(filename) {
    events.EventEmitter.call(this);
    this.filename = filename;
};
开发者ID:coolkev,项目名称:pumpkinlights,代码行数:4,代码来源:mpg123.ts

示例9: constructor

	constructor() {
		super();
		util.inherits(XLSX, events.EventEmitter);
		events.EventEmitter.call(this);
	}
开发者ID:ffalt,项目名称:xlsx-extract,代码行数:5,代码来源:index.ts

示例10: Board


//.........这里部分代码省略.........
                break;
              
              case FrameTypes.Heartbeat:
                
                var collectingLoops = frameBuffer[1] + (frameBuffer[2] << 8);
                var idleLoops = frameBuffer[3] + (frameBuffer[4] << 8);
                self.emit('heartbeat', { collectingLoops: collectingLoops, idleLoops: idleLoops, data: new Buffer(frameBuffer).slice(5, frameBuffer.length - 1) });
                
                break;
              
              // FrameType unknown, use a generic frame received callback
              default:
                
                // TODO: consider expressing this as multiple params?
                self.emit('frame', { sequence: frameSequence, data: new Buffer(frameBuffer) });
                  
                break;
                
            }
          }
          
          readState = ReadState.FrameStart;
          break;
      }            
    }
  };
  
  serialPort.on('data', parseFrame);
  serialPort.on('open', function() { self.emit('open'); });
  serialPort.on('close', function() { self.emit('close'); });
  serialPort.on('end', function() { self.emit('end'); });
  serialPort.on('error', function(err) { self.emit('error', err); });
  
  events.EventEmitter.call(this);
  
  this.close = function close(callback) {
    self.sendFrame(self.FunctionIds.reset);
    serialPort.close(callback);
  };
  
  this.sendFrame = function sendFrame() {
  
    var frame = new Buffer(0);

    for (var i = 0; i < arguments.length; i++) {

      var data = arguments[i];

      if (!Buffer.isBuffer(data)) {
        if (isNaN(data)) {
          data = new Buffer(data);
        } else {
          // Don't allow a number passed as data to be misinterpreted as a buffer length
          data = new Buffer([data]);
        }
      }

      frame = Buffer.concat( [frame, data] );
    }
    
    // Artificial 8-bit rollover
    if (writeSequence === 256) { 
      writeSequence = 0;
    }
    
    // Reinitialize the writeArray and checksum
开发者ID:imclab,项目名称:node-reflecta,代码行数:67,代码来源:reflecta.ts


注:本文中的events.EventEmitter.call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。