Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Use vue 3 + TypeScript to reconstruct the original plugin): … #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

likaia
Copy link

@likaia likaia commented Nov 1, 2020

…Delete the obsolete vue 2 method in the code and replace it with the wording supported by vue 3

重构插件让其支持了vue3,未修改代码中的单元测试部分代码。

…Delete the obsolete vue 2 method in the code and replace it with the wording supported by vue 3

重构插件让其支持了vue3,未修改代码中的单元测试部分代码。
@gustawdaniel
Copy link

gustawdaniel commented Nov 12, 2020

Is rewrite to typescript planned? What need to be done to merge this pull request?

@likaia
Copy link
Author

likaia commented Nov 12, 2020

yes,Already done。

link:https://github.com/likaia/vue-native-websocket-vue3

@likaia
Copy link
Author

likaia commented Nov 12, 2020

Do you have permission to merge?
Do you speak Chinese?

@pidehen23
Copy link

good big white @likaia

@weglov
Copy link
Collaborator

weglov commented Nov 12, 2020

@likaia good work, but it would be useful to have comments in English to make it clears to everyone

@likaia
Copy link
Author

likaia commented Nov 12, 2020

Yes, the translation plan is on the agenda.

"description": "native websocket implemantation for vuejs and vuex",
"main": "dist/build.js",
"main": "dist/Main.js",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be lowercase main.js

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalization is fine, Because the main file is Main.ts, I capitalized.

removeListener(label: T, callback: () => void, vm: T): boolean {
// 从监听列表中获取当前事件
const listeners = this.listeners.get(label);
let index;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs type number

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, should be index: number yes?


if (listeners && listeners.length) {
// 寻找当前事件在事件监听列表的位置
index = listeners.reduce((i: any, listener: any, index: T) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i and index should be type number

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'm careless😂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'm careless😂

@@ -0,0 +1,108 @@
import Observer from "./Observer";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file really should be main.ts since it's not a Class file, and is consistent with other library naming conventions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, how can Observer replace the entry file of the main.ts plugin?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, there's no way to comment on a file itself. I was just saying that this file Main.ts should be renamed to main.ts and then update accordingly in the package.json, per my other comment

@@ -0,0 +1,28 @@
// 插件内用到的类型进行统一定义

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this file be renamed to just types.ts ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to change it to type.ts, but I think my current name looks a little more intuitive

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps lib-types.ts would be more consistent?

*/
defaultPassToStore(
eventName: string,
event: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create new type for this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a new type? what type?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about VuexStore since that's really what this property is defining

@likaia
Copy link
Author

likaia commented Nov 20, 2020

English documentation and English comments have been added.

link: https://github.com/likaia/vue-native-websocket-vue3/blob/master/README-EN.md

}

/**
* 添加事件监听
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These doc comments need to at least have English translations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants