Code Monkey home page Code Monkey logo

Comments (5)

liuyanghejerry avatar liuyanghejerry commented on July 29, 2024

另外,RealtimeObject.room(id, cb)也没有向服务端发起sign请求,而websocket的帧当中也没有join相关的操作。

from js-realtime-sdk.

wangxiao avatar wangxiao commented on July 29, 2024

非常感谢,对你使用产生的问题非常抱歉,已经提交代码,会尽快发布。
#38

from js-realtime-sdk.

wangxiao avatar wangxiao commented on July 29, 2024

已经修正发布 2.0.1 版本 https://github.com/leancloud/js-realtime-sdk/releases/tag/2.0.1

from js-realtime-sdk.

liuyanghejerry avatar liuyanghejerry commented on July 29, 2024

建议realtimeObject.room()方法中的cb回调,能将room对象直接作为参数,因为这个回调执行的比room方法返回还早:

someVar.room = null;
someVar.room = realtimeObj.room(roomId, function() {console.log(someVar.room)})
// oops, console.log prints null.
// Because callback is called before the room is returned.

而如果使用room作为回调参数的话:

 realtimeObj.room(roomId, function(room) {console.log(room)})
// this seems fine.

Node.js当中,对于这样的情况使用nextTick来调用回调,但是浏览器里就只有个setTimeout,比较丑陋,如果忍受不了这样丑陋,起码应该给这个回调一个room作为参数。

from js-realtime-sdk.

wangxiao avatar wangxiao commented on July 29, 2024

好的,这种情况我考虑一下。单独另外弄个 issue 吧,感谢反馈。

from js-realtime-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.