Sha256: 072a017291bdbfdbff55975084f3faa48afe846a5fee53f13807d6a7fe781a47
Contents?: true
Size: 1.36 KB
Versions: 29
Compression:
Stored size: 1.36 KB
Contents
//= require ./mixins/mix_spec_into_component /* This optional extension re-enables the React mixin system for plain JS * classes, e.g. ES6 classes, Backbone classes, ES3 module pattern classes * You require the extension like `//= require revelry/extensions/mixins` and * then you just use appComponent and revComponent like normal. * Internally, this works by wrapping the appComponent and revComponent methods * in a function closure which actually does the mixing in, since React punts. */ (function(Rev) { function mixinListForObject(object) { var mixinList = object.mixins || []; mixinList.push(Rev.Mixins.Core); return _.uniq(mixinList); } function forEachMixin(object, fn) { var mixin, i, l; var mixinList = mixinListForObject(object); l = mixinList.length; for(i = 0; i < l; i++) { mixin = mixinList[i]; fn(mixin); } } function decorateComponentMethod(componentMethod) { return function(name, object) { var componentClass = (componentMethod.bind(Rev))(name, object); if(typeof object === 'function') { // ES6 class forEachMixin(object, function(mixin){ Rev.__mixSpecIntoComponent(componentClass, mixin); }); } } } Rev.appComponent = decorateComponentMethod(Rev.appComponent); Rev.registerComponent = decorateComponentMethod(Rev.registerComponent); })(Rev);
Version data entries
29 entries across 29 versions & 1 rubygems