Skip to content

Commit

Permalink
fix: should extends from egg-core BaseContextClass (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored and popomore committed Sep 7, 2017
1 parent a9936a3 commit 3aaee8f
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions lib/core/base_context_class.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const EggCoreBaseContextClass = require('egg-core').BaseContextClass;
const BaseContextLogger = require('./base_context_logger');

const LOGGER = Symbol('BaseContextClass#logger');
Expand All @@ -9,36 +10,7 @@ const LOGGER = Symbol('BaseContextClass#logger');
* it's instantiated in context level,
* {@link Helper}, {@link Service} is extending it.
*/
class BaseContextClass {

/**
* @constructor
* @param {Context} ctx - context instance
* @since 1.0.0
*/
constructor(ctx) {
/**
* @member {Context} BaseContextClass#ctx
* @since 1.0.0
*/
this.ctx = ctx;
/**
* @member {Application} BaseContextClass#app
* @since 1.0.0
*/
this.app = ctx.app;
/**
* @member {Config} BaseContextClass#config
* @since 1.0.0
*/
this.config = ctx.app.config;
/**
* @member {Service} BaseContextClass#service
* @since 1.0.0
*/
this.service = ctx.service;
}

class BaseContextClass extends EggCoreBaseContextClass {
get logger() {
if (!this[LOGGER]) this[LOGGER] = new BaseContextLogger(this.ctx, this.pathName);
return this[LOGGER];
Expand Down

0 comments on commit 3aaee8f

Please sign in to comment.