Package Exports
- remi-expose
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remi-expose) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
remi-expose
A remi extension that adds the expose method to the target
Installation
npm i remi-expose
Usage
Registering the extension
const remi = require('remi')
const remiExpose = require('remi-expose')
const app = {}
const registrator = remi(app)
registrator.hook(remiExpose())
Once the remi-expose extension is registered, the remi plugins can expose values.
app.expose(key, value)
Used within a plugin to expose a property via app.plugins[name] where:
key
- the key assigned (server.plugins[name][key]
).value
- the value assigned.
exports.register = function(app, opts, next) {
app.expose('util', () => console.log('something'))
next()
}
server.expose(obj)
Merges a shallow copy of an object into to the existing content of server.plugins[name]
where:
obj
- the object merged into the exposed properties container.
exports.register = function(app, opts, next) {
app.expose({
util() {
console.log('something')
},
})
next()
}
License
MIT © Zoltan Kochan