Browse Source

Merge pull request #987 in VISUAL/fineui from ~TELLER/fineui:typescript to master

* commit 'a00b6aff02041dc761e47fcdf24dde877a7de506':
  KERNEL-801 fineui ts环境搭建
es6
Teller 6 years ago
parent
commit
aae29a01ea
  1. 15
      .eslintrc
  2. 6
      package.json
  3. 27
      tsconfig.json
  4. 3
      typescript/core/i18n.ts
  5. 47
      typescript/core/ob.ts
  6. 0
      typescript/index.ts
  7. 3775
      yarn.lock

15
.eslintrc

@ -1,5 +1,20 @@
{
"extends": "eslint:recommended",
"env": {
"browser": true,
"node": true,
"es6": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"plugins": ["@typescript-eslint"],
"rules": {
// 声明
"no-use-before-define": "error",

6
package.json

@ -5,7 +5,10 @@
"main": "index.js",
"dependencies": {},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^1.11.0",
"@typescript-eslint/parser": "^1.11.0",
"chai": "^4.2.0",
"eslint": "^6.0.1",
"express": "^4.15.2",
"grunt": "^1.0.1",
"grunt-contrib-clean": "^1.1.0",
@ -23,7 +26,8 @@
"karma-coverage": "^1.1.2",
"karma-mocha": "^1.3.0",
"mocha": "^5.2.0",
"open": "0.0.5"
"open": "0.0.5",
"typescript": "^3.5.2"
},
"scripts": {
"grunt": "grunt",

27
tsconfig.json

@ -0,0 +1,27 @@
{
"compilerOptions": {
"sourceMap": true,
"target": "es2017",
"module": "es2015",
"moduleResolution": "node",
"lib": [
"es2017",
"dom"
],
"declaration": true,
"experimentalDecorators": true,
"outDir": "./bin",
"baseUrl": ".",
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": [
"typescript/*.ts",
"typescript/**/*.ts"
]
}

3
typescript/core/i18n.ts

@ -0,0 +1,3 @@
export declare type _addI18n = (v: string) => string;
export declare type _i18nText = (key: string) => string;

47
typescript/core/ob.ts

@ -0,0 +1,47 @@
export declare class _OB {
protected props: Props | (<T>(config: T) => Props & T);
protected options: Props;
private events?: {
[eventName: string]: Function[];
};
public init: Function | null;
public destroyed: Function | null;
protected _defaultConfig: (..._args: any[]) => { [key: string]: any } | {};
protected _init: () => void;
private _initListeners: () => void;
private _getEvents: () => { [eventName: string]: Function[] };
public on: (eventName: string, fn: Function) => void;
public once: (eventName: string, fn: Function) => void;
public un: (eName: string, fn: Function) => void;
protected _initRef: () => void;
protected _purgeRef: () => void;
public purgeListeners: () => void;
public fireEvent: (eName: string, ...args: any[]) => boolean;
public destroy: () => void;
}
interface Props {
listeners?: {
eventName: string;
action: (...args: any[]) => any;
target?: _OB;
once?: boolean;
}[];
[key: string]: any;
}

0
typescript/index.ts

3775
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save