-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide mixin functionality for generated components
- Loading branch information
Justin Moore
committed
Mar 25, 2016
1 parent
0823ec6
commit 2a9777c
Showing
8 changed files
with
252 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script> | ||
/** | ||
* @license | ||
* Copyright (c) 2015 MediaMath Inc. All rights reserved. | ||
* This code may only be used under the BSD style license found at http://mediamath.github.io/strand/LICENSE.txt | ||
*/ | ||
(function (scope) { | ||
|
||
var MixinFindable = scope.MixinFindable = { | ||
|
||
properties: { | ||
mixinFindable: { | ||
type: Object, | ||
value: function () { | ||
return this; | ||
}, | ||
notify: true, | ||
}, | ||
}, | ||
|
||
mixinsForValue: function (value) { | ||
return null; // override | ||
}, | ||
|
||
mixinsForValuePath: function (value, path) { | ||
return null; // override | ||
}, | ||
|
||
prototypeAsMixin: function (prototype) { | ||
var mixin = {}; | ||
|
||
if (Array.isArray(prototype.behaviors) && | ||
prototype.behaviors.indexOf(MixinFindable) < 0) { | ||
prototype.behaviors.push(MixinFindable); | ||
} else if (!prototype.behaviors) { | ||
prototype.behaviors = [ MixinFindable ]; | ||
} | ||
|
||
for (var key in prototype) { | ||
mixin[key] = prototype[key]; | ||
} | ||
|
||
prototype.mixinsForValue = function () { | ||
return mixin; | ||
}; | ||
|
||
return prototype; | ||
}, | ||
|
||
}; | ||
|
||
})(window.StrandTraits = window.StrandTraits || {}); | ||
</script> |
Oops, something went wrong.