double0201 2013-09-06 20:07
浏览 88
已采纳

Ratchet / When.js:“未捕获的ReferenceError:模块未定义”

I'm trying to use ratchet for reflecting the changes made to my database realtime. I used the code of the pusher app (http://socketo.me/docs/push). But i am getting error in that.

The moment I open the client side page :

Uncaught ReferenceError: module is not defined                    when.js:900
(anonymous function)                                              when.js:900
(anonymous function)                                              when.js:15
(anonymous function)                                              when.js:900

After this I typed: conn.subscribe('topic'); //This subscribes the topic.

Now the moment I make changes to this topic, an error pops up where the changes are to be displayed.

Error 2 :

Uncaught TypeError: undefined is not a function         [VM] autobahn.min.js (124):66
(anonymous function)                                    [VM] autobahn.min.js (124):66
c._websocket.onmessage                                  [VM] autobahn.min.js (124):66

Any help ?

  • 写回答

2条回答 默认 最新

  • doutuzhuohao6449 2013-09-26 11:42
    关注

    This may be solvable by using the following JavaScript before including the when.js file:

    window.define = function(factory) {
        try{ delete window.define; } catch(e){ window.define = void 0; } // IE
        window.when = factory();
    };
    window.define.amd = {};
    

    Then, include your when.js file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功