restructuring the project

This commit is contained in:
Kevin Jahns
2019-03-01 23:26:40 +01:00
parent f6b4819ae3
commit 75f4a0a5f0
163 changed files with 6423 additions and 10770 deletions

39
src/utils/YEvent.js Normal file
View File

@@ -0,0 +1,39 @@
/**
* @module utils
*/
/**
* YEvent describes the changes on a YType.
*/
export class YEvent {
/**
* @param {Type} target The changed type.
*/
constructor (target) {
/**
* The type on which this event was created on.
* @type {Type}
*/
this.target = target
/**
* The current target on which the observe callback is called.
* @type {Type}
*/
this.currentTarget = target
}
/**
* Computes the path from `y` to the changed type.
*
* The following property holds:
* @example
* let type = y
* event.path.forEach(dir => {
* type = type.get(dir)
* })
* type === event.target // => true
*/
get path () {
return this.currentTarget.getPathTo(this.target)
}
}