Skip to content

Commit 3620fcd

Browse files
committed
Added some basic model class
1 parent 11a2f01 commit 3620fcd

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

Diff for: src/core/Model.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Model is the base class for all data models and is intended to be the base
3+
* class for all data models.
4+
* @class
5+
*/
6+
export class Model {
7+
constructor() {
8+
// Initialize properties
9+
}
10+
static get properties() {
11+
return {}
12+
}
13+
toString() {
14+
return JSON.stringify(this);
15+
}
16+
}

Diff for: src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
// This file defines all the styles and elements used for the web components
33

4+
// Core
5+
import './core/Model';
6+
import './core/Provider';
7+
48
// Buttons
59
import './component/button/ButtonElement';
610
import './component/button/ButtonGroupElement';

Diff for: src/test.js

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
// Core
44
import Provider from './core/Provider';
55
import Event from './core/Event';
6+
import { Model } from './core/Model';
7+
8+
// Create a model
9+
10+
class MyModel extends Model {
11+
12+
}
613

714
// Test
815
window.addEventListener('load', () => {
@@ -69,4 +76,8 @@ window.addEventListener('load', () => {
6976
}
7077
});
7178
});
79+
80+
// Print out model
81+
var model = new MyModel({ name: "John Doe", age: 21});
82+
console.log("" + model);
7283
});

0 commit comments

Comments
 (0)