ancient-graph-spreading
Version:
Automatic maintenance spreading of graph according other graphs.
17 lines • 4.26 kB
JavaScript
;Object.defineProperty(exports,'__esModule',{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if('value'in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined}else{return get(parent,property,receiver)}}else if('value'in desc){return desc.value}else{var getter=desc.get;if(getter===undefined){return undefined}return getter.call(receiver)}};function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function')}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')}return call&&(typeof call==='object'||typeof call==='function')?call:self}function _inherits(subClass,superClass){if(typeof superClass!=='function'&&superClass!==null){throw new TypeError('Super expression must either be null or a function, not '+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}/**
* This method allows you to use LaunchedGraph class to its inheritance chain.
* Field launched is required!
* Manage field launched.
*
* @param {Class} ParentClassGraph
* @return {Class} LaunchedGraph
* @description `import { factoryLaunchedGraph } from 'ancient-graph-spreading';`
*/function factoryLaunchedGraph(ParentClassGraph){var LaunchedGraph=function(_ParentClassGraph){_inherits(LaunchedGraph,_ParentClassGraph);function LaunchedGraph(){_classCallCheck(this,LaunchedGraph);return _possibleConstructorReturn(this,(LaunchedGraph.__proto__||Object.getPrototypeOf(LaunchedGraph)).apply(this,arguments))}_createClass(LaunchedGraph,[{key:'insert',/**
* Parent insert with added launched field. You can override it field in modifier.
*/value:function insert(modifier,callback,context){if(!modifier[this.config.aliases.launched])modifier[this.config.aliases.launched]=['spread'];else{if(Object.prototype.toString.call(modifier[this.config.aliases.launched])!=='[object Array]'){modifier[this.config.aliases.launched]=[modifier[this.config.aliases.launched]]}modifier[this.config.aliases.launched].push('spread')}return _get(LaunchedGraph.prototype.__proto__||Object.getPrototypeOf(LaunchedGraph.prototype),'insert',this).call(this,modifier,callback,context)}/**
* Parent update, but if source or target changed, then to the launched field will be added values unspread and spread. You can override it field in modifier.
*/},{key:'update',value:function update(selector,modifier,callback,context){if(!modifier.hasOwnProperty(this.config.aliases.launched)){modifier[this.config.aliases.launched]={add:['unspread','spread']}}return _get(LaunchedGraph.prototype.__proto__||Object.getPrototypeOf(LaunchedGraph.prototype),'update',this).call(this,selector,modifier,callback,context)}/**
* The method is strictly designed so that the class inherits from ExistedGraph.
* Adds to launched field unspread value.
*/},{key:'remove',value:function remove(selector,callback,context){if(!context)var context={};if(!context.modifier)context.modifier={};context.modifier[this.config.aliases.launched]=['unspread'];return _get(LaunchedGraph.prototype.__proto__||Object.getPrototypeOf(LaunchedGraph.prototype),'remove',this).call(this,selector,callback,context)}}]);return LaunchedGraph}(ParentClassGraph);return LaunchedGraph};exports.factoryLaunchedGraph=factoryLaunchedGraph;
//# sourceMappingURL=launched.js.map