Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 5x 5x 5x 5x 5x 226x 226x 226x 226x 226x 5x 226x 226x 226x 226x | /*!
* Dynamic Component Indexer
*
* Copyright 2016 Raising the Floor - International
*
* 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 = fluid || require("infusion");
var gpii = fluid.registerNamespace("gpii");
(function () {
/** Maintains an index on a parent component of a collection of dynamic components which maps
* the value held at some specified path on the dynamic component onto the component's member name
* A piece of "proto-framework" which is a framework candidate.
*/
fluid.defaults("gpii.indexedDynamicComponent", {
gradeNames: "fluid.component",
components: {
// This reference needs to be overridden by the concrete grade user
// TODO: Enhance "notImplemented" scheme to support custom messages when user has not overridden material
// which requires to be overridden
dynamicIndexTarget: "{fluid.notImplemented}.mustBeOverridden"
},
// The path of the collection/member at which the index is to be held
dynamicIndexTargetPath: "{fluid.notImplemented}.mustBeOverridden",
// The path in this component at which the key is to be found
dynamicIndexKeyPath: "{fluid.notImplemented}.mustBeOverridden",
listeners: {
"onCreate.indexedDynamicComponent": "gpii.indexedDynamicComponent.onCreate",
"onDestroy.indexedDynamicComponent": "gpii.indexedDynamicComponent.onDestroy"
}
});
gpii.indexedDynamicComponent.onCreate = function (that) {
var key = fluid.getForComponent(that, that.options.dynamicIndexKeyPath);
var ourPath = fluid.pathForComponent(that);
var memberName = ourPath[ourPath.length - 1];
var index = fluid.get(that.dynamicIndexTarget, that.options.dynamicIndexTargetPath);
index[key] = memberName;
};
gpii.indexedDynamicComponent.onDestroy = function (that) {
var key = fluid.getForComponent(that, that.options.dynamicIndexKeyPath);
var index = fluid.get(that.dynamicIndexTarget, that.options.dynamicIndexTargetPath);
Eif (index) { // workaround for FLUID-5930
delete index[key];
}
};
})();
|