Thanks for this. I think most advanced developers understand the concept of Injection, but it's very interesting to see a simple implementation of it! Great video.
When I add -keep-as3-metadata+=Inject I'm getting some extra metadata that isn't in your video: __go_to_definition_help and it has two args, file, which is the location to my ViewMediator.as file, and pos. This is messing up the example, because it makes variable.metadata.@name == "Inject__go_to_definition_help". I can still get the example to work by using if (variable.metadata.(@name == "Inject") != undefined), just curious if you know why this extra metadata is there. It looks like it's metadata that Eclipse uses to jump to a definition, just not sure why it's in the .as file.
so that it might not append any metadata that's trying to be stored from elsewhere? But if you add any additional metadata beyond "Inject", then you'd have to use +=.
After some Googling it seems it's added only for debug builds, and you don't have to use -keep-as3-metadata anymore. Apparently this is new to the Flex 4 compiler.
Thanks for this. I think most advanced developers understand the concept of Injection, but it's very interesting to see a simple implementation of it! Great video.
ReplyDeleteDitto what Ace said. Been using Swift Suspenders but it's great to see it from scratch.
ReplyDeleteWhen I add -keep-as3-metadata+=Inject I'm getting some extra metadata that isn't in your video: __go_to_definition_help and it has two args, file, which is the location to my ViewMediator.as file, and pos. This is messing up the example, because it makes variable.metadata.@name == "Inject__go_to_definition_help". I can still get the example to work by using if (variable.metadata.(@name == "Inject") != undefined), just curious if you know why this extra metadata is there. It looks like it's metadata that Eclipse uses to jump to a definition, just not sure why it's in the .as file.
ReplyDeleteI honestly have no idea. You could try changing:
ReplyDelete-keep-as3-metadata+=Inject
to
-keep-as3-metadata=Inject (remove the "+")
so that it might not append any metadata that's trying to be stored from elsewhere? But if you add any additional metadata beyond "Inject", then you'd have to use +=.
After some Googling it seems it's added only for debug builds, and you don't have to use -keep-as3-metadata anymore. Apparently this is new to the Flex 4 compiler.
ReplyDeleteCool, thanks for the update.
ReplyDelete