Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "eventproxy in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'eventproxy' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

function count(dirname) {
  var ep = Eventproxy.create();
  ep.fail(function (err) {
    console.error(err.stack);
  });

  fs.readdir(dirname, ep.doneLater('files'));

  ep.once('files', function (files) {
    files.forEach(function (filename) {
      var filepath = path.join(dirname, filename);
      fs.stat(filepath, ep.doneLater(function (stat) {
        ep.emit('stat', {
          stat: stat,
          filepath: filepath,
          filename: filename
        });
      }));
var getContent = function getContent(filepath, callback) {
    var ep = eventproxy.create();
    ep.fail(callback);

    fs.readFile(filepath, 'utf8', ep.doneLater(function (content) {
      var title = content.slice(0, content.indexOf('\n')).trim().replace(/^[#\s]+/, '');
      var body = marked(content);
      ep.emit('data', {title: title, body: body});
    }));
    fs.readFile(options.layout, 'utf8', ep.done('layout'));

    ep.all('layout', 'data', function (layout, data) {
      var html = layout.replace(options.titleHolder, data.title)
       .replace(options.bodyHolder, data.body);
      callback(null, html);
    });
  };
TBase.prototype.count = function (user, ids, callback) {
  if (typeof ids === 'string') {
    ids = ids.split(',');
  }
  var list = [];
  while (ids.length > this.config.count_max_number) {
    list.push(ids.splice(0, this.config.count_max_number));
  }
  if (ids.length > 0) {
    list.push(ids);
  }
  var ep = EventProxy.create();
  ep.after('counts', list.length, function (results) {
    var counts = [];
    for (var i = 0; i < results.length; i++) {
      counts = counts.concat(results[i]);
    }
    callback(null, counts);
  });
  ep.once('error', function (err) {
    ep.unbind();
    callback(err);
  });
  var self = this;
  list.forEach(function (ids) {
    self._count.call(self, user, ids.join(','), function (err, counts) {
      if (err) {
        return ep.emit('error', err);
exports.getUserIdByUserName= function(userName, callback) {
    var ep = EventProxy.create();
    userName = '%'+userName+'%';
    var paramObj = {
        userName: userName,
    };
    mysqlClient.query({
        sql: "SELECT userId,department,userName FROM USER WHERE userName like :userName ;",
        params: paramObj
    }, function(err, rows) {
        if (err || !rows) {
            console.dir(err);
            return callback(new ServerError(), null);
        }
        callback(null, rows);
    });
};
exports.exportInv = function(req, res, next) {
    debugCtrller("/controllers/stockIn/exportInv");

    if (!req.session || !req.session.user) {
        return res.redirect("/login");
    }
    var ep = EventProxy.create();

    //静态标题
    var conf = {};
    conf.cols = [{
        caption: '名称',
        type: 'string'
    }, {
        caption: '类别',
        type: 'string'
    }, {
        caption: '单位',
        type: 'string'
    }, {
        caption: '单价',
        type: 'string'
    }, {
exports.exportSO = function(req, res, next) {
    debugCtrller("controllers/fixedAsset/exportExcel");
    if (!req.session || !req.session.user) {
        return res.redirect("/login");
    }
    var ep = EventProxy.create();

    //静态标题
    var conf = {};
    conf.cols = [{
        caption: '出库日期',
        type: 'string'
    }, {
        caption: '申请人',
        type: 'string'
    }, {
        caption: '类别',
        type: 'string'
    }, {
        caption: '商品名称',
        type: 'string'
    }, {
exports.exportSI = function(req, res, next) {
    debugCtrller("/controllers/stockIn/exportSI");

    if (!req.session || !req.session.user) {
        return res.redirect("/login");
    }
    var ep = EventProxy.create();

    //静态标题
    var conf = {};
    conf.cols = [{
        caption: '入库日期',
        type: 'string'
    }, {
        caption: '类别',
        type: 'string'
    }, {
        caption: '商品名称',
        type: 'string'
    }, {
        caption: '单位',
        type: 'string'
    }, {
exports.exportExcel = function (req, res, next) {
    debugCtrller("controllers/fixedAsset/exportExcel");
    var companyId    = req.params.companyId || "";

    try {
        check(companyId).notEmpty();
    } catch (e) {
        return res.send(resUtil.generateRes(null, config.statusCode.STATUS_INVAILD_PARAMS));
    }
    var ep = EventProxy.create();

    //静态标题
    var conf ={};
    conf.cols = [
        {caption:'部门', type:'string'},
        {caption:'部门编号', type:'string'},
        {caption:'领用人', type:'string'},
        {caption:'领用人工号', type:'string'},
        {caption:'设备编号', type:'string'},
        {caption:'旧编号', type:'string'},
        {caption:'资产名称', type:'string'},
        {caption:'资产类型', type:'string'},
        {caption:'资产归属', type:'string'},
        {caption:'当前状态', type:'string'},
        {caption:'品牌', type:'string'},
        {caption:'型号', type:'string'},
exports.refreshToken = function (req, res, next) {
  var user_id = req.session.user._id;

  var ep = EventProxy.create();
  ep.fail(next);

   User.getUserById(user_id, ep.done(function (user) {
    user.accessToken = uuid.v4();
    user.save(ep.done(function () {
      res.json({status: 'success', accessToken: user.accessToken});
    }));
  }));
};
function get(callback) {
  var ep = Eventproxy.create();
  ep.fail(callback);

  proxy.getUser(ep.done('user'));
  ep.once('user', function (user) {
    proxy.getPosts(user, ep.done('posts'));
    proxy.getComments(user, ep.done('comments'));
  });

  ep.all('user', 'posts', 'comments',
    function (user, posts, comments) {
    callback(null, {
      user: user,
      posts: posts,
      comments: comments
    });
  });

Is your System Free of Underlying Vulnerabilities?
Find Out Now