Results 1 to 2 of 2
  1.    #1  
    I've created some custom widgets for an app I am working on, but there is one thing I can't figure out. I'd like to be able to call a function in one of my widgets from the scene that it is in. Is there any way to do that?

    I know that I can update the widget's model, and that I can send events from the widget, but neither of those really fits in this situation.
  2.    #2  
    Nevermind, I figured it out. Sadly I can't find much documentation for the widget controller, but the SDK contains a lot of reference code for the default widgets.

    Inside a widget's setup function you can call this.controller.exposeMethods(['foo', 'bar']); This will allow a consumer of the widget to call those functions after getting a reference to the widget instance with this.controller.get().

    For example:
    this.controller.setupWidget('foo', {}, {});
    this.foo = this.controller.get('foo');
    this.foo.mojo.someExposedMethod();

Posting Permissions