Skip to content

Single instance as argument to multiple constructors #75

Answered by joachimvh
jessegeens asked this question in Q&A
Discussion options

You must be logged in to vote

This will indeed only create 1 instance of your ConfigurationManager. You could put a console.log call in the constructor to see how many times it is called. Identical @ids always corresponds to the same instance of a class. Components.js reads out all the JSON-LD files and interprets them as RDF, so from its point of view there is just a single urn:pepsa-component:default:ConfigurationManager subject that has the ConfigurationManager type, and some other triples referencing that same URI.

The wrong way to do it would have been to replace those { "@id": "urn:pepsa-component:default:ConfigurationManager" } blocks with { "@type": "ConfigurationManager" }. This would have created several bla…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jessegeens
Comment options

Answer selected by rubensworks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants