1.0.1 • Published 4 years ago

@feizheng/service-decorator v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

service-decorator

A decorator for inject service to your context.

installation

npm i -S @feizheng/service-decorator

usage

// ... 
module: {
  rules: [
    {
      test: /\.(js)$/,
      use: ['babel-loader'],
      include: [
        resolve(__dirname, 'test'), 
        // poinit1:
        resolve(__dirname, './index')
      ]
    }
  ]
},
resolve: {
  alias: {
    // poinit2:
    services: resolve(__dirname, 'test/services')
  }
},
plugins: [
  new HtmlWebpackPlugin(),
  new webpack.ProvidePlugin({
    // poinit3:
    service: resolve(__dirname, './index.js')
  })
]
// ... 

app

@service(['test1', 'test2', 'test-obj'])
class App {
  start() {
    console.log(this.$test1);
    console.log(this.$test2);
    console.log(this.$testObj);
  }
}
1.0.1

4 years ago

1.0.0

4 years ago