From 6e59b5881def886adcec48efcbb03b70deedeeb9 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 5 Nov 2014 14:05:14 -0800 Subject: [PATCH] [Example] Use implementations in examples Use implementations of custom extensions in examples. WTD-518. --- example/builtins/src/ExampleDirective.js | 16 +++++++++--- example/extensions/bundle.json | 4 +++ example/extensions/src/SomeExample.js | 31 ++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 example/extensions/src/SomeExample.js diff --git a/example/builtins/src/ExampleDirective.js b/example/builtins/src/ExampleDirective.js index 5bae65ebbe..2f2a454be7 100644 --- a/example/builtins/src/ExampleDirective.js +++ b/example/builtins/src/ExampleDirective.js @@ -8,9 +8,11 @@ define( function () { "use strict"; - var HAS_EXTENSIONS = "A directive loaded these example extensions.", + var HAS_EXTENSIONS = "A directive loaded these message from " + + "example extensions.", NO_EXTENSIONS = "A directive tried to load example extensions," + - " but found none."; + " but found none.", + MESSAGE = "I heard this from my partial constructor."; /** * @@ -22,8 +24,14 @@ define( HAS_EXTENSIONS : NO_EXTENSIONS; template += ""; diff --git a/example/extensions/bundle.json b/example/extensions/bundle.json index 3093a4ee8b..aca5319321 100644 --- a/example/extensions/bundle.json +++ b/example/extensions/bundle.json @@ -6,6 +6,10 @@ "examples": [ { "text": "I came from example/extensions" + }, + { + "implementation": "SomeExample.js", + "depends": [ "exampleService" ] } ] } diff --git a/example/extensions/src/SomeExample.js b/example/extensions/src/SomeExample.js new file mode 100644 index 0000000000..ceab8e2c6a --- /dev/null +++ b/example/extensions/src/SomeExample.js @@ -0,0 +1,31 @@ +/*global define,Promise*/ + +/** + * Module defining SomeExample. Created by vwoeltje on 11/5/14. + */ +define( + [], + function () { + "use strict"; + + /** + * + * @constructor + */ + function SomeExample(exampleService, message) { + return { + getText: function () { + return [ + '"', + exampleService.getMessage(), + '" and "', + message, + '"' + ].join(""); + } + }; + } + + return SomeExample; + } +); \ No newline at end of file