This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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