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