Skip to content

Commit

Permalink
types: add types for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Mar 10, 2021
1 parent fb18871 commit 62db6f7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 22 deletions.
8 changes: 2 additions & 6 deletions lib/mini-vue.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/mini-vue.cjs.js.map

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions lib/mini-vue.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/mini-vue.esm.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface Debug {
mainPath: (string) => any;
}

declare var debug: Debug;
9 changes: 3 additions & 6 deletions src/mini-core/LanguageTranslator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// TODO 需要后面扩展 map 即可
const c2eMap = {
你好: "hello",
"调用 patch": "call patch function",
};

const e2cMap = {
Expand All @@ -12,6 +13,7 @@ export default class LanguageTranslator {
constructor() {
// TODO这个值可以基于环境变量自行控制
this.currentLanguage = "cn";
// this.currentLanguage = "en";
}

private get currentMap(): any {
Expand All @@ -20,11 +22,6 @@ export default class LanguageTranslator {

transition(text) {
const result = this.currentMap[text];

if (result) {
return result;
} else {
return text;
}
return result ? result : text;
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"preserveConstEnums": false,
"sourceMap": true,
"downlevelIteration": true,
"lib": ["es6","DOM"]
"lib": ["es6", "DOM"]
},
"include": ["src/index.ts"]
"include": ["src/index.ts", "src/global.d.ts"]
}

0 comments on commit 62db6f7

Please sign in to comment.