diff --git a/examples/gpii-driver/README.md b/examples/gpii-driver/README.md new file mode 100644 index 000000000..bdac05593 --- /dev/null +++ b/examples/gpii-driver/README.md @@ -0,0 +1,7 @@ +This directory contains an example that provides customisations to the GPII by means of the "driver" pattern. + +This example demonstrates how to inject a component named `gpii.app` as a subcomponent of the GPII flow manager. To start the customized GPII, simply type: + + node driver.js + +from this directory. The logging information output by `gpii.app` will appear on the GPII console. diff --git a/examples/gpii-driver/app.js b/examples/gpii-driver/app.js new file mode 100644 index 000000000..38f51228e --- /dev/null +++ b/examples/gpii-driver/app.js @@ -0,0 +1,30 @@ +/* + * Copyright 2017 OCAD University + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +"use strict"; + +var fluid = require("infusion"); + +fluid.defaults("gpii.app", { + gradeNames: ["fluid.component"], + components: { + appImpl: { + type: "fluid.component", + options: { + listeners: { + "onCreate.log": { + listener: "console.log", + args: ["!!! The app component has been created!"] + } + } + } + } + } +}); diff --git a/examples/gpii-driver/app.json b/examples/gpii-driver/app.json new file mode 100644 index 000000000..9fd65d790 --- /dev/null +++ b/examples/gpii-driver/app.json @@ -0,0 +1,15 @@ +{ + "type": "gpii.appDemo", + "options": { + "gradeNames": ["fluid.component"], + "distributeOptions": { + "distributeApp": { + "record": "gpii.app", + "target": "{that flowManager}.options.gradeNames" + } + } + }, + "mergeConfigs": [ + "../../gpii/configs/gpii.config.cloudBased.development.all.local.json" + ] +} diff --git a/examples/gpii-driver/driver.js b/examples/gpii-driver/driver.js new file mode 100644 index 000000000..b4f1fa15c --- /dev/null +++ b/examples/gpii-driver/driver.js @@ -0,0 +1,26 @@ +/*! + * Driver file to demonstrate GPII customisations + * + * Copyright 2012 OCAD University + * Copyright 2017 OCAD University + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +"use strict"; + +var fluid = require("infusion"), + kettle = fluid.registerNamespace("kettle"); + +require("kettle"); +require("../../index.js"); +require("./app.js"); + +kettle.config.loadConfig({ + configName: kettle.config.getConfigName("app"), + configPath: __dirname +});