Skip to content

Instantly share code, notes, and snippets.

@jakwuh
Last active July 31, 2016 14:23
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 jakwuh/81d996a27b5c933086cbc99c4bbb33d4 to your computer and use it in GitHub Desktop.
Save jakwuh/81d996a27b5c933086cbc99c4bbb33d4 to your computer and use it in GitHub Desktop.
DI v2
{
"Human": "Man",
"Man": {
"home": "Home",
"office": "Office"
},
"Home": ["Building.homeFactory", {
"kitchen": "ManHomeKitchen#clean"
}]
,
"Office": ["Building.officeFactory", {
"kitchen": "Kitchen.factory#clean"
}]
}
{
"Human": "Woman",
"Woman": {
"home": "Home",
"office": "Office"
},
"Home": ["Building.homeFactory", {
"kitchen": "WomanHomeKitchen#clean"
}]
,
"Office": ["Building.officeFactory", {
"kitchen": "Kitchen.factory#clean"
}]
}
@Inject({
home: 'Home',
office: 'Office'
})
@Provide('Human')
class Man {
}
@Inject({
home: 'Home',
office: 'Office'
})
@Provide('Human')
class Woman {
}
@Provide({
kitchen: 'Kitchen.factory#clean'
})
class Building {
@Provide('Office', ['Building'])
officeFactory() {
}
@Provide('Home', ['Building', {
'kitchen': 'WomanHomeKitchen#clean'
}])
homeFactory() {
}
}
@Provide('WomanHomeKitchen')
@Provide('ManHomeKitchen')
class Kitchen {
factory() {
}
clean() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment