-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
model.ts
38 lines (32 loc) · 991 Bytes
/
model.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @module ui/model
*/
import { ObservableMixin } from '@ckeditor/ckeditor5-utils';
import { extend } from 'lodash-es';
/**
* The base MVC model class.
*/
export default class Model extends ObservableMixin() {
[ x: string ]: unknown;
/**
* Creates a new Model instance.
*
* @param attributes The model state attributes to be defined during the instance creation.
* @param properties The (out of state) properties to be appended to the instance during creation.
*/
constructor( attributes?: Record<string, unknown>, properties?: Record<string, unknown> ) {
super();
// Extend this instance with the additional (out of state) properties.
if ( properties ) {
extend( this, properties );
}
// Initialize the attributes.
if ( attributes ) {
this.set( attributes );
}
}
}