From 9a6a3733d6bc898e646b589f946609afdd521d6b Mon Sep 17 00:00:00 2001 From: Qi Yu Date: Fri, 12 May 2017 18:54:22 +0800 Subject: [PATCH] refactor: rename private method name to symbol --- lib/application.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/application.js b/lib/application.js index 3f86de8383..8927ce1a4f 100644 --- a/lib/application.js +++ b/lib/application.js @@ -12,6 +12,8 @@ const KEYS = Symbol('Application#keys'); const HELPER = Symbol('Application#Helper'); const LOCALS = Symbol('Application#locals'); const LOCALS_LIST = Symbol('Application#localsList'); +const BIND_EVENTS = Symbol('Application#bindEvents'); +const WARN_CONFUSED_CONFIG = Symbol('Application#warnConfusedConfig'); const EGG_LOADER = Symbol.for('egg#loader'); const EGG_PATH = Symbol.for('egg#eggPath'); const CLUSTER_CLIENTS = Symbol.for('egg#clusterClients'); @@ -40,8 +42,8 @@ class Application extends EggApplication { // dump config after loaded, ensure all the dynamic modifications will be recorded this.dumpConfig(); - this.warnConfusedConfig(); - this.bindEvents(); + this[WARN_CONFUSED_CONFIG](); + this[BIND_EVENTS](); } get [EGG_LOADER]() { @@ -203,7 +205,7 @@ class Application extends EggApplication { * * @private */ - bindEvents() { + [BIND_EVENTS]() { // Browser Cookie Limits: http://browsercookielimits.squawky.net/ this.on('cookieLimitExceed', ({ name, value, ctx }) => { const err = new Error(`cookie ${name}'s length(${value.length}) exceed the limit(4093)`); @@ -220,7 +222,7 @@ class Application extends EggApplication { * * @private */ - warnConfusedConfig() { + [WARN_CONFUSED_CONFIG]() { const confusedConfigurations = this.config.confusedConfigurations; Object.keys(confusedConfigurations).forEach(key => { if (this.config[key] !== undefined) {