Skip to content

Instantly share code, notes, and snippets.

@young-steveo
Created February 12, 2016 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save young-steveo/30fa6f39ecb6c08f17ad to your computer and use it in GitHub Desktop.
Save young-steveo/30fa6f39ecb6c08f17ad to your computer and use it in GitHub Desktop.
import Bottle from "../bottle.js";
import Proxy from "../node_modules/harmony-proxy/index.js";
import Fuel from "./Fuel.js";
import Engine from "./Engine.js";
import Car from "./Car.js";
class handler {
static get(bottle, name){
return bottle.container[name];
}
};
let bottle = new Bottle();
bottle.constant('GASOLINE', 'Gasoline');
bottle.constant('DIESEL', 'Diesel');
bottle.constant('V6', 'v6');
bottle.constant('V12', 'v12');
bottle.service('Gasoline', Fuel, 'GASOLINE');
bottle.service('Diesel', Fuel, 'DIESEL');
bottle.service('DieselEngine', Engine, 'V6', 'Diesel');
bottle.service('GasolineEngine', Engine, 'V12', 'Gasoline');
bottle.service('Toyota', Car, 'DieselEngine');
bottle.service('Ferrari', Car, 'GasolineEngine');
export default new Proxy(bottle, handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment