How to use js-event-bus - 3 common examples

To help you get started, we’ve selected a few js-event-bus 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 dreamnettech / dreamtime / src / electron / src / modules / tools / fs.js View on Github external
export function download(url, options = {}) {
  const bus = new EventBus()

  // eslint-disable-next-line no-param-reassign
  options = {
    showSaveAs: false,
    directory: app.getPath('downloads'),
    filename: basename(url).split('?')[0].split('#')[0],
    ...options,
  }

  let filepath = join(options.directory, options.filename)
  let cancelled = false

  if (options.showSaveAs) {
    // save as dialog
    filepath = dialog.showSaveDialogSync({
      defaultPath: filepath,
github dreamnettech / dreamtime / src / electron / src / modules / tools / power.js View on Github external
// body preferences
  args.push('--bsize', preferences.body.boobs.size)
  args.push('--asize', preferences.body.areola.size)
  args.push('--nsize', preferences.body.nipple.size)
  args.push('--vsize', preferences.body.vagina.size)
  args.push('--hsize', preferences.body.pubicHair.size)

  logger.info('Spawning DreamPower.', {
    input: inputFilepath,
    output: outputFilepath,
    args,
  })

  const process = exec(args)

  const bus = new EventBus()

  process.on('error', (error) => {
    logger.error(error)
    bus.emit('error', null, error)
  })

  process.stdout.on('data', (output) => {
    const stdout = output.toString().trim().split('\n')
    bus.emit('stdout', null, stdout)
  })

  process.stderr.on('data', (output) => {
    logger.warn(`stderr: ${output}`)
    bus.emit('stderr', null, output)
  })
github dreamnettech / dreamtime / src / modules / events.js View on Github external
// DreamTime.
// Copyright (C) DreamNet. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License 3.0 as published by
// the Free Software Foundation. See 
//
// Written by Ivan Bravo Bravo , 2019.

import EventBus from 'js-event-bus'

export const events = new EventBus()

js-event-bus

Event bus for your Javascript applications

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular js-event-bus functions