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

List cross node patch #195

Closed
wants to merge 33 commits into from
Closed

List cross node patch #195

wants to merge 33 commits into from

Conversation

notechsolution
Copy link

改动的目的是让List支持在跨节点的环境下可用,改动的文件有如下:

  • list.js
    • 在原有的add方法添加req参数。如果不传该参数,则跟原来功能逻辑一样;如果传递该参数,则会将创建的List对象(包括变量跟方法) 序列化并保存到 session里面。
    • List对象添加 values 变量。由于反序列化之后的 用户定义函数 没有之前的上下文,如果程序需要除了用户之外的其它信息,可以通过这个变量传递,wechat.js会回传这个变量
  • wechat.js
    • done 和 wait方法都增加了对 req.wxsession._list的处理,若不用空,则用serialize进行反序列化,以得到List对象;若为空,则按照以前逻辑,从静态变量里面取
    • done 和 wait方法都增加了 回传用户传递过来的 预定义值
  • package.json
    • 增加了node-serialize,可以将对象的变量和方法进行序列化跟反序列化
  • list.test.js
    • 增加对List序列化,反序列化的测试
  • list3.test.js
    • 新增测试文件,用于测试List在跨节点环境下的实现

@JacksonTian
Copy link
Member

  1. 测试挂了。
  2. 需要序列化方法吗。

@notechsolution
Copy link
Author

测试在弄

@notechsolution
Copy link
Author

1.测试已通过
2.如果不序列化方法,当用户回复List之后,没法找到对应的执行函数

@JacksonTian
Copy link
Member

能否做下 rebase。这么多commit合并进去没法看。

@notechsolution
Copy link
Author

没问题,有这种情况下 rebase的参考链接不?

@notechsolution
Copy link
Author

commit太难看,关闭这个request,重建pull reqest #198 。 不好意思!

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.

None yet

3 participants