ancient-funicular
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -5,3 +5,3 @@ import { TClass, IInstance } from 'ancient-mixins/lib/mixins'; | ||
import { TFunicularsManager } from './funiculars-manager'; | ||
declare type TFunicular = IFunicular<IFunicularEventsList<IFunicularEventData>>; | ||
declare type TFunicular = IFunicular<TCursor, IFunicularEventsList<IFunicularEventData>>; | ||
declare enum EFunicularState { | ||
@@ -18,5 +18,2 @@ Constructed = 0, | ||
} | ||
interface IFunicularEventListener { | ||
(data: IFunicularEventData): void; | ||
} | ||
interface IFunicularEventsList<ID extends IFunicularEventData> extends INodeEventsList { | ||
@@ -43,8 +40,11 @@ mount: ID; | ||
} | ||
interface IFunicular<IEventsList extends IFunicularEventsList<IFunicularEventData>> extends INode<IEventsList> { | ||
Node: TClass<TFunicular>; | ||
interface IFunicularClone { | ||
(instance: IInstance): IInstance; | ||
} | ||
interface IFunicular<IC extends TCursor, IEventsList extends IFunicularEventsList<IFunicularEventData>> extends INode<IEventsList> { | ||
clone: IFunicularClone; | ||
state: EFunicularState; | ||
childs: TFunicularsManager; | ||
parents: TFunicularsManager; | ||
cursor: TCursor; | ||
cursor: IC; | ||
result: any; | ||
@@ -54,3 +54,3 @@ needRemount: boolean; | ||
remounted: TFunicular; | ||
mount(cursor: TCursor): void; | ||
mount(cursor: IC): void; | ||
remount(): void; | ||
@@ -76,6 +76,6 @@ unmount(): void; | ||
} | ||
declare function mixin<T extends TClass<IInstance>>(superClass: T): any; | ||
declare const MixedFunicular: TClass<IFunicular<IFunicularEventsList<IFunicularEventData>>>; | ||
declare function mixin<T extends TClass<IInstance>>(superClass: T, clone: IFunicularClone): any; | ||
declare const MixedFunicular: TClass<TFunicular>; | ||
declare class Funicular extends MixedFunicular { | ||
} | ||
export { mixin as default, mixin, MixedFunicular, Funicular, IFunicular, EFunicularState, IFunicularCallback, IFunicularEventData, IFunicularEventListener, IFunicularEventsList, TFunicular }; | ||
export { mixin as default, mixin, MixedFunicular, Funicular, IFunicular, EFunicularState, IFunicularCallback, IFunicularClone, IFunicularEventData, IFunicularEventsList, TFunicular }; |
@@ -26,8 +26,8 @@ "use strict"; | ||
exports.EFunicularState = EFunicularState; | ||
function mixin(superClass) { | ||
return /** @class */ (function (_super) { | ||
__extends(Funicular, _super); | ||
function Funicular() { | ||
function mixin(superClass, clone) { | ||
return (function (_super) { | ||
__extends(FunicularMixed, _super); | ||
function FunicularMixed() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.Node = Funicular; | ||
_this.clone = clone; | ||
_this.state = EFunicularState.Constructed; | ||
@@ -40,3 +40,3 @@ _this.childs = new funiculars_manager_1.FunicularsManager(); | ||
} | ||
Funicular.prototype.mount = function (cursor) { | ||
FunicularMixed.prototype.mount = function (cursor) { | ||
var _this = this; | ||
@@ -66,3 +66,3 @@ if (this.state !== EFunicularState.Constructed) { | ||
}; | ||
Funicular.prototype.remount = function () { | ||
FunicularMixed.prototype.remount = function () { | ||
var _this = this; | ||
@@ -82,3 +82,3 @@ if (this.state === EFunicularState.Mounted) { | ||
}; | ||
Funicular.prototype.unmount = function () { | ||
FunicularMixed.prototype.unmount = function () { | ||
var _this = this; | ||
@@ -102,9 +102,9 @@ if (this.state === EFunicularState.Mounted || this.state === EFunicularState.Remounting) { | ||
}; | ||
Funicular.prototype.register = function (callback) { | ||
FunicularMixed.prototype.register = function (callback) { | ||
throw new Error('Method register must defined in this class!'); | ||
}; | ||
Funicular.prototype.unregister = function (callback) { | ||
FunicularMixed.prototype.unregister = function (callback) { | ||
throw new Error('Method unregister must defined in this class!'); | ||
}; | ||
Funicular.prototype.cursorFilling = function (callback) { | ||
FunicularMixed.prototype.cursorFilling = function (callback) { | ||
var _this = this; | ||
@@ -121,3 +121,3 @@ this.emit('cursorFilling', { funicular: this }); | ||
}; | ||
Funicular.prototype.childsMounting = function (callback) { | ||
FunicularMixed.prototype.childsMounting = function (callback) { | ||
var _this = this; | ||
@@ -130,3 +130,3 @@ this.emit('childsMounting', { funicular: this }); | ||
}; | ||
Funicular.prototype.childsUnmounting = function (callback) { | ||
FunicularMixed.prototype.childsUnmounting = function (callback) { | ||
var _this = this; | ||
@@ -139,9 +139,9 @@ this.emit('childsUnmounting', { funicular: this }); | ||
}; | ||
Funicular.prototype.requestChilds = function (callback) { | ||
FunicularMixed.prototype.requestChilds = function (callback) { | ||
throw new Error('Method requestChilds must defined in this class!'); | ||
}; | ||
Funicular.prototype.abandonChilds = function (callback) { | ||
FunicularMixed.prototype.abandonChilds = function (callback) { | ||
throw new Error('Method abandonChilds must defined in this class!'); | ||
}; | ||
Funicular.prototype.start = function (callback) { | ||
FunicularMixed.prototype.start = function (callback) { | ||
var _this = this; | ||
@@ -154,3 +154,3 @@ this.emit('starting', { funicular: this }); | ||
}; | ||
Funicular.prototype.stop = function (callback) { | ||
FunicularMixed.prototype.stop = function (callback) { | ||
var _this = this; | ||
@@ -163,9 +163,9 @@ this.emit('stopping', { funicular: this }); | ||
}; | ||
Funicular.prototype.starting = function (callback) { | ||
FunicularMixed.prototype.starting = function (callback) { | ||
throw new Error('Method starting must defined in this class!'); | ||
}; | ||
Funicular.prototype.stopping = function (callback) { | ||
FunicularMixed.prototype.stopping = function (callback) { | ||
throw new Error('Method stopping must defined in this class!'); | ||
}; | ||
Funicular.prototype.watchChildsEvents = function () { | ||
FunicularMixed.prototype.watchChildsEvents = function () { | ||
var _this = this; | ||
@@ -183,19 +183,19 @@ this.removedListener = function (_a) { | ||
}; | ||
Funicular.prototype.unwatchChildsEvents = function () { | ||
FunicularMixed.prototype.unwatchChildsEvents = function () { | ||
this.childs.off('removed', this.removedListener); | ||
this.childs.off('remounted', this.remountedListener); | ||
}; | ||
Funicular.prototype.childDestroyed = function (child) { | ||
FunicularMixed.prototype.childDestroyed = function (child) { | ||
this.remount(); | ||
}; | ||
Funicular.prototype.childRemounted = function (child) { | ||
FunicularMixed.prototype.childRemounted = function (child) { | ||
this.remount(); | ||
}; | ||
Funicular.prototype.addParentToChilds = function () { | ||
FunicularMixed.prototype.addParentToChilds = function () { | ||
var _this = this; | ||
_.each(this.childs.nodes, function (child) { return child.parents.add(_this); }); | ||
}; | ||
Funicular.prototype.cloneAndMount = function (callback) { | ||
FunicularMixed.prototype.cloneAndMount = function (callback) { | ||
var _this = this; | ||
var clone = new this.Node(this.id); | ||
var clone = this.clone(this); | ||
clone.on('mounted', function () { | ||
@@ -207,10 +207,10 @@ _this.remounted = clone; | ||
}; | ||
return Funicular; | ||
}(node_1.Node)); | ||
return FunicularMixed; | ||
}(superClass)); | ||
} | ||
exports["default"] = mixin; | ||
exports.mixin = mixin; | ||
var MixedFunicular = mixin(node_1.Node); | ||
var MixedFunicular = mixin(node_1.Node, function (i) { return new Funicular(i.id); }); | ||
exports.MixedFunicular = MixedFunicular; | ||
var Funicular = /** @class */ (function (_super) { | ||
var Funicular = (function (_super) { | ||
__extends(Funicular, _super); | ||
@@ -217,0 +217,0 @@ function Funicular() { |
@@ -12,3 +12,3 @@ import { TClass, IInstance } from 'ancient-mixins/lib/mixins'; | ||
} | ||
declare function mixin<T extends TClass<IInstance>>(superClass: T): any; | ||
declare function mixin<T extends TClass<IInstance>>(superClass: T, Node?: TClass<IInstance>): any; | ||
declare const MixedFunicularsManager: TClass<TFunicularsManager>; | ||
@@ -15,0 +15,0 @@ declare class FunicularsManager extends MixedFunicularsManager { |
@@ -15,8 +15,9 @@ "use strict"; | ||
var funicular_1 = require("./funicular"); | ||
function mixin(superClass) { | ||
return /** @class */ (function (_super) { | ||
function mixin(superClass, Node) { | ||
if (Node === void 0) { Node = funicular_1.Funicular; } | ||
return (function (_super) { | ||
__extends(FunicularsManager, _super); | ||
function FunicularsManager() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.Node = funicular_1.Funicular; | ||
_this.Node = Node; | ||
return _this; | ||
@@ -31,3 +32,3 @@ } | ||
exports.MixedFunicularsManager = MixedFunicularsManager; | ||
var FunicularsManager = /** @class */ (function (_super) { | ||
var FunicularsManager = (function (_super) { | ||
__extends(FunicularsManager, _super); | ||
@@ -34,0 +35,0 @@ function FunicularsManager() { |
{ | ||
"name": "ancient-funicular", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Abstract hierarchical life cycle of the mount.", | ||
@@ -9,3 +9,3 @@ "bugs": "https://github.com/AncientSouls/Funicular/issues", | ||
"scripts": { | ||
"tsc": "rm -rf ./lib ./tests && tsc ./src/*/*.ts --outDir ./ --sourceMap -d true --module CommonJS", | ||
"tsc": "rm -rf ./lib ./tests && tsc", | ||
"test": "mocha ./tests/index.js --require source-map-support/register", | ||
@@ -12,0 +12,0 @@ "tslint": "tslint -c tslint.json './src/**/*.ts'", |
@@ -23,4 +23,2 @@ "use strict"; | ||
it('lifecycle', function () { | ||
// In this test there are no situations outside the scope of the test, such as: | ||
// existance of necessary data, local and global funicular identifiers, executable data... | ||
var base = new cursor_1.Cursor(); | ||
@@ -30,7 +28,7 @@ var ccm = new childs_cursors_manager_1.ChildsCursorsManager(); | ||
var all = new funiculars_manager_1.FunicularsManager(); | ||
var TestFunicular = /** @class */ (function (_super) { | ||
var TestFunicular = (function (_super) { | ||
__extends(TestFunicular, _super); | ||
function TestFunicular() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.Node = TestFunicular; | ||
_this.clone = function (i) { return new TestFunicular(i.id); }; | ||
return _this; | ||
@@ -57,3 +55,3 @@ } | ||
else { | ||
var newChild_1 = new this.Node(c); | ||
var newChild_1 = new TestFunicular(c); | ||
newChild_1.on('mounted', function () { return callback(newChild_1); }); | ||
@@ -60,0 +58,0 @@ newChild_1.mount(ccm.nodes[newChild_1.id]); |
@@ -5,5 +5,7 @@ "use strict"; | ||
var funicular_1 = require("./funicular"); | ||
var executable_funicular_1 = require("./executable-funicular"); | ||
describe('AncientSouls/Funicular:', function () { | ||
funicular_1["default"](); | ||
executable_funicular_1["default"](); | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -8,2 +8,4 @@ { | ||
"no-increment-decrement": false, | ||
"no-unused-variable": [true], | ||
"function-name": false, | ||
"variable-name": [ | ||
@@ -10,0 +12,0 @@ true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49995
24
701
2