如何使用performance.now()来做更快的setinterval

时间:2017-10-24 15:11:46

标签: setinterval

如何使用performance.now()来做更快的setinterval

const Hapi = require('hapi');
const Gun = require('gun');
const pem = require('pem');

pem.createCertificate({ days: 1, selfSigned: true }, function (err, keys) {
  if (err) {
    throw err
  }
  const server = new Hapi.Server;

  var tls = {
    key: keys.serviceKey,
    cert: keys.certificate
  };

  server.connection({
    port: 8080,
    tls
  });

  server.connections.forEach(c => Gun({ web: c.listener, file: 'data.json' }));

  server.route({
    method: 'GET',
    path: '/',
    handler: function (request, reply) {
      reply('Server works!');
    }
  });

  server.start();
})

我希望这比1毫秒更快

0 个答案:

没有答案