Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

widgets/WidgetName/WidgetNameViews.ejs: Optional second/third/... view templates

Sample Widget/Page Definition File
Code Block

// Example Widget Definition
function(app, ns, data, utils){
    // Create Widget short name for local reference
    ns.ExampleWidget = {
        SomeWidgetFunctionObjectOrEnum : {...}
    };

    // Create Widget data namespace
    data.ExampleWidget = {
        WidgetDataVal1 : "foo",
        WidgetDataVal2 : {...}
    };

    // It's common to always defer loading of css and data since they aren't debugged
    utils.requireCSS("widgets/ExampleWidget/ExampleWidget.CSS");
    utils.requireScript("widgets/ExampleWidget/widget_test_data.js", false);

    // Only defer load these if it's turned on
    if (app.config.isDeferLoad) {
        utils.requireScript("widgets/ExampleWidget/ExampleWidgetModel.js", true);
        utils.requireScript("widgets/ExampleWidget/ExampleWidgetCtrl.js", true);
    }
// Pass in external values that will be used by this code
}(
raft.app,     // The app namespace
raft.widgets, // The widget or page namespace
raft.data,    // The data namespace
raft.utils    // Application framework utilities namespace
));

$(document).ready(function()){
    // Code to run when document is finished loading
}

Utilities

Helper Functions

...