Module name "bridge-js" has not been loaded yet for context

74 views
Skip to first unread message

bobzsj87

unread,
Aug 6, 2012, 3:49:54 AM8/6/12
to bridge...@googlegroups.com
Hi,

I am new to Bridge-js. Just trying its demo code using js on Chrome, and cannot get it going. I have included require.js, then bridge.min.js. And error occurs at:


var Bridge = require('bridge-js');

Not sure how to debug this. PLease help.

Bob

Ian Serlin

unread,
Aug 6, 2012, 5:23:06 AM8/6/12
to bridge...@googlegroups.com
Hi Bob,

If you actually wanted to use requirejs you would download bridge.min.js to your local directory and then include bridge like this:

require(["lib/bridge"], function(util) {
    //This function is called when lib/bridge.js is loaded.
    //If util.js calls define(), then this function is not fired until
    //util's dependencies have loaded, and the util argument will hold
    //the module value for "helper/util".
});
However, the require('bridge-js') you are referencing is for use in nodejs, not in the browser. So, if you don't care to use requirejs (and you don't have to) you can simply just put the bridge script tag in your html:

<script type="text/javascript" src="http://www.getbridge.com/js/bridge.min.js"></script>

and the Bridge variable should be available to you when the page has finished loading.

See this line: 

Client-side Javascript specific note: This tutorial shows typical node.js usage. If you are following this tutorial using Javascript in the web browser, please omit lines using the require function.

from the bridge getting started page: https://www.getbridge.com/docs/gettingstarted/js

HTH!

Ian Serlin
Owner Useful IO LLC



--
You received this message because you are subscribed to the Google Groups "Bridge" group.
To post to this group, send email to bridge...@googlegroups.com.
To unsubscribe from this group, send email to bridge-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/bridge-users/-/xrN-B61gzVMJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

bobzsj87

unread,
Aug 6, 2012, 5:27:03 AM8/6/12
to bridge...@googlegroups.com
Many thanks Ian! That's very helpful.

在 2012年8月6日星期一UTC+8下午5时23分06秒,Ian Serlin写道:
To unsubscribe from this group, send email to bridge-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages