ancient-cursor
Advanced tools
Comparing version 0.2.3 to 0.2.6
@@ -15,13 +15,13 @@ "use strict"; | ||
if (childData) { | ||
if (!this.nodes[id]) | ||
this.create(id); | ||
this.nodes[id].exec(null, childData); | ||
if (!this.list.nodes[id]) | ||
this.add(new this.Node(id)); | ||
this.list.nodes[id].exec(null, childData); | ||
} | ||
else { | ||
if (this.nodes[id]) | ||
this.nodes[id].destroy(); | ||
if (this.list.nodes[id]) | ||
this.list.nodes[id].destroy(); | ||
} | ||
} | ||
else { | ||
_.each(this.nodes, (childCursor, id) => { | ||
_.each(this.list.nodes, (childCursor, id) => { | ||
const childData = bundle_1.get(newValue, id); | ||
@@ -34,5 +34,5 @@ if (!childData) | ||
_.each(newValue, (childData, id) => { | ||
if (!this.nodes[id]) | ||
this.create(id); | ||
this.nodes[id].exec(null, bundle_1.get(newValue, id)); | ||
if (!this.list.nodes[id]) | ||
this.add(new this.Node(id)); | ||
this.list.nodes[id].exec(null, bundle_1.get(newValue, id)); | ||
}); | ||
@@ -39,0 +39,0 @@ } |
@@ -20,4 +20,2 @@ import { TClass, IInstance } from 'ancient-mixins/lib/mixins'; | ||
interface ICursorsManagerEventsList extends IManagerEventsList { | ||
changed: ICursorsManagerChangedEventData; | ||
exec: ICursorsManagerExecEventData; | ||
added: ICursorsManagerEventData; | ||
@@ -24,0 +22,0 @@ removed: ICursorsManagerEventData; |
{ | ||
"name": "ancient-cursor", | ||
"version": "0.2.3", | ||
"version": "0.2.6", | ||
"description": "Abstract container of data synchronization.", | ||
@@ -13,7 +13,8 @@ "bugs": "https://github.com/AncientSouls/Cursor/issues", | ||
"dev-link": "npm link ancient-mixins", | ||
"dev-test": "(rm -rf .dev && git clone -b dev https://github.com/AncientSouls/AncientSouls.github.io.git .dev && cd .dev && git submodule init && git submodule update && npm run dev-install) && npm link ./ && (cd .dev && npm run dev-use-links && npm run dev-check)" | ||
"dev-test": "(rm -rf .dev && git clone -b dev https://github.com/AncientSouls/AncientSouls.github.io.git .dev && cd .dev && git submodule init && git submodule update && npm run dev-install) && npm link ./ && (cd .dev && npm run dev-use-links && npm run dev-check)", | ||
"np": "./node_modules/np/cli.js --no-publish --no-yarn --yolo --any-branch" | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.17.5", | ||
"ancient-mixins": "^0.0.0" | ||
"ancient-mixins": "^0.0.11" | ||
}, | ||
@@ -25,2 +26,3 @@ "devDependencies": { | ||
"mocha": "^5.0.4", | ||
"np": "^2.20.1", | ||
"source-map-support": "^0.5.3", | ||
@@ -27,0 +29,0 @@ "tslint": "^5.9.1", |
@@ -21,5 +21,5 @@ "use strict"; | ||
}); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.nodes.c.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.list.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.list.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.list.nodes.c.data); | ||
parent.apply({ | ||
@@ -30,6 +30,6 @@ type: 'set', | ||
}); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.list.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), { b: 4 }); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.nodes.c.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.list.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.list.nodes.c.data); | ||
parent.apply({ | ||
@@ -40,7 +40,7 @@ type: 'set', | ||
}); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.nodes.c.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.list.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.list.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.list.nodes.c.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}d`), { d: 5 }); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}d`), ccm.nodes.d.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}d`), ccm.list.nodes.d.data); | ||
parent.apply({ | ||
@@ -50,6 +50,6 @@ type: 'unset', | ||
}); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.nodes.c.data); | ||
chai_1.assert.isNotOk(ccm.nodes.d); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}a`), ccm.list.nodes.a.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}b`), ccm.list.nodes.b.data); | ||
chai_1.assert.deepEqual(_.get(parent.data, `${_path}c`), ccm.list.nodes.c.data); | ||
chai_1.assert.isNotOk(ccm.list.nodes.d); | ||
} | ||
@@ -56,0 +56,0 @@ function default_1() { |
@@ -11,5 +11,6 @@ "use strict"; | ||
const cursorsManager = new cursors_manager_1.CursorsManager(); | ||
const cursor = cursorsManager.create(); | ||
const cursor = new cursorsManager.Node(); | ||
cursorsManager.add(cursor); | ||
cursor.exec(true, { a: [{ b: { c: 'd' } }] }); | ||
cursorsManager.on('changed', ({ data, oldValue, newValue, bundlePath, bundle, watch, cursor, manager, }) => { | ||
cursorsManager.list.on('changed', ({ data, oldValue, newValue, bundlePath, bundle, watch, cursor, manager, }) => { | ||
chai_1.assert.deepEqual(data, { a: [{ b: { d: 'e' } }] }); | ||
@@ -55,3 +56,3 @@ chai_1.assert.deepEqual(oldValue, { c: 'd' }); | ||
const { id, queryId, query, data } = manager; | ||
manager.on('add', ({ node }) => storageManagers[manager.id] = node.id); | ||
manager.on('added', ({ node }) => storageManagers[manager.id] = node.id); | ||
manager.on('removed', ({ node }) => delete storageManagers[manager.id]); | ||
@@ -83,3 +84,4 @@ }; | ||
manager = new StoredCursorsManager('cursors'); | ||
cursor = manager.create('a'); | ||
cursor = new manager.Node('a'); | ||
manager.add(cursor); | ||
cursor.apply({ type: 'set', path: '', value: { x: 123 } }); | ||
@@ -89,3 +91,4 @@ manager = undefined; | ||
manager = new StoredCursorsManager('cursors'); | ||
cursor = manager.create('a'); | ||
cursor = new manager.Node('a'); | ||
manager.add(cursor); | ||
chai_1.assert.deepEqual(cursor.data, { x: 123 }); | ||
@@ -92,0 +95,0 @@ }); |
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
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
81204
1001
10
+ Addedancient-mixins@0.0.11(transitive)
- Removedancient-mixins@0.0.0(transitive)
Updatedancient-mixins@^0.0.11