1

Two children of same type

How can the controller knows which instance's method is called If the application has two instances with same mojit type?

[ { "settings" : [ "master" ], "specs" : { "frame" : { "type" : "HTMLFrameMojit", "config" : { "child" : { "type" : "canvas", "config" : { "children" : { "problem" : { "type" : "block" }, "solution" : { "type" : "block" } } } } } } } },

by
1 Reply
  • You have two options here:

    • you can pass config object for each child (problem and solution), in which case you can access that config from within the instance using ac.config.get('something') to identify which one is being executed.

    • you can create to separate instances in specs, something like: specs: { solutionBase: { type: 'block' }, problemBase: { type: 'block' } } then setting the children as { problem: { base: 'problemBase' }, solution: { base: 'solutionBase' } }, in which case you can check this in your controller: ac.instance.base === 'problemBase' vs ac.instance.base === 'solutionBase'.

    Or you can combine both of them to have instance bases plus configurations :), which I believe is the right thing to do.

    0

Recent Posts

in Yahoo! Mojito