Permalink
Browse files

feat(endpoint): Added an Endpoint resolver

  • Loading branch information...
RWOverdijk committed Jan 15, 2016
1 parent 92583c0 commit 65419d45181017654cac57bbf03aeaa59d74a56e
Showing with 37 additions and 0 deletions.
  1. +37 −0 src/endpoint.js
@@ -0,0 +1,37 @@
import {resolver} from 'aurelia-dependency-injection';
import {Config} from './config';

@resolver()
export class Endpoint {

/**
* Construct the resolver with the specified key.
*
* @param {string} key
*/
constructor(key) {
this._key = key;
}

/**
* Resolve for key.
*
* @param {Container} container
*
* @return {*}
*/
get(container) {
return container.get(Config).getEndpoint(this._key);
}

/**
* Get a new resolver for `key`.
*
* @param {string} key
*
* @return {Endpoint}
*/
static of(key) {
return new Endpoint(key);
}
}

0 comments on commit 65419d4

Please sign in to comment.