From 7a95e0439ea640a089794fcc2486fb68426bce3d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 23 Feb 2018 17:06:31 +0200 Subject: [PATCH] refactor(client) init --- client/client.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/client/client.js b/client/client.js index f6fc2656..3a479245 100644 --- a/client/client.js +++ b/client/client.js @@ -1,11 +1,14 @@ 'use strict'; +/* global Util, DOM */ + const itype = require('itype/legacy'); const rendy = require('rendy'); const exec = require('execon'); const Images = require('./dom/images'); const join = require('join-io/www/join'); const jonny = require('jonny/legacy'); +const bind = (f, ...a) => () => f(...a); const { apiURL, @@ -13,8 +16,6 @@ const { buildFromJSON, } = require('../common/cloudfunc'); -/* global Util, DOM */ - module.exports = new CloudCmdProto(Util, DOM); function CloudCmdProto(Util, DOM) { @@ -173,16 +174,12 @@ function CloudCmdProto(Util, DOM) { * инициализации */ this.init = (prefix, config) => { - const func = () => { - exec.series([ - initModules, - baseInit, - loadPlugins, - () => { - CloudCmd.route(location.hash); - } - ]); - }; + const func = bind(exec.series, [ + initModules, + baseInit, + loadPlugins, + exec.with(CloudCmd.route, location.hash), + ]); const funcBefore = (callback) => { const src = prefix + '/join:' + [