Skip to content

Commit 99474ce

Browse files
committed
Added first import of js-framework
1 parent 33e7223 commit 99474ce

File tree

10 files changed

+4806
-68
lines changed

10 files changed

+4806
-68
lines changed

.eslintrc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
env:
2+
browser: true
3+
es2021: true
4+
extends:
5+
- airbnb-base
6+
parserOptions:
7+
ecmaVersion: 12
8+
sourceType: module
9+
rules: {}

.gitignore

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,100 +5,33 @@ npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
77
lerna-debug.log*
8-
9-
# Diagnostic reports (https://nodejs.org/api/report.html)
108
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
139
pids
1410
*.pid
1511
*.seed
1612
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
1913
lib-cov
20-
21-
# Coverage directory used by tools like istanbul
2214
coverage
2315
*.lcov
24-
25-
# nyc test coverage
2616
.nyc_output
27-
28-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
2917
.grunt
30-
31-
# Bower dependency directory (https://bower.io/)
3218
bower_components
33-
34-
# node-waf configuration
3519
.lock-wscript
36-
37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
3820
build/Release
39-
40-
# Dependency directories
4121
node_modules/
4222
jspm_packages/
43-
44-
# TypeScript v1 declaration files
45-
typings/
46-
47-
# TypeScript cache
48-
*.tsbuildinfo
49-
50-
# Optional npm cache directory
5123
.npm
52-
53-
# Optional eslint cache
5424
.eslintcache
55-
56-
# Microbundle cache
57-
.rpt2_cache/
58-
.rts2_cache_cjs/
59-
.rts2_cache_es/
60-
.rts2_cache_umd/
61-
62-
# Optional REPL history
63-
.node_repl_history
64-
65-
# Output of 'npm pack'
66-
*.tgz
67-
68-
# Yarn Integrity file
69-
.yarn-integrity
70-
71-
# dotenv environment variables file
7225
.env
7326
.env.test
74-
75-
# parcel-bundler cache (https://parceljs.org/)
7627
.cache
77-
78-
# Next.js build output
7928
.next
80-
81-
# Nuxt.js build / generate output
8229
.nuxt
8330
dist
84-
85-
# Gatsby files
8631
.cache/
87-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88-
# https://nextjs.org/blog/next-9-1#public-directory-support
89-
# public
90-
91-
# vuepress build output
9232
.vuepress/dist
93-
94-
# Serverless directories
9533
.serverless/
96-
97-
# FuseBox cache
9834
.fusebox/
99-
100-
# DynamoDB Local files
10135
.dynamodb/
102-
103-
# TernJS port file
10436
.tern-port
37+
.DS_Store

html/index.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<html>
2+
3+
<head>
4+
<title>Test</title>
5+
<script src="../dist/js/index.js"></script>
6+
</head>
7+
8+
<body>
9+
<h1>Tests</h1>
10+
<script>
11+
class StrModel extends mvc.Model {
12+
constructor(data) {
13+
super({ value: data });
14+
}
15+
}
16+
17+
mvc.Model.define(StrModel, {
18+
"value": "string",
19+
});
20+
21+
class KeyModel extends mvc.Model {
22+
constructor(data) {
23+
super(data);
24+
}
25+
getClassName() {
26+
return this.$className;
27+
}
28+
get override() {
29+
return "done!";
30+
}
31+
}
32+
33+
mvc.Model.define(KeyModel, {
34+
"str": "_id string",
35+
"map": "{}number",
36+
"arr": "[]StrModel",
37+
"override": "string",
38+
});
39+
40+
var obj = new KeyModel({ _id: "[this is the key]", map: { a: 1, b: 2 }, arr: [ "a", "b" ], override: "not done" });
41+
obj.$type.forEach((v,k) =>{
42+
console.log(`${k} => `,v);
43+
});
44+
console.log("className=",obj.$className);
45+
console.log("getClassName=",obj.getClassName());
46+
console.log("str=",obj.str);
47+
console.log("map=",obj.map);
48+
console.log("arr=",obj.arr);
49+
console.log("override=",obj.override);
50+
console.log("toString=","" + obj);
51+
</script>
52+
</body>
53+
54+
</html>

js/error.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Error class
2+
3+
export default class Error {
4+
constructor(reason, code) {
5+
this.$reason = reason;
6+
this.$code = code;
7+
}
8+
}

js/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Model from './model';
2+
import View from './view';
3+
import Provider from './provider';
4+
import Error from './error';
5+
6+
export {
7+
Model, View, Provider, Error,
8+
};

0 commit comments

Comments
 (0)