Documentation? Running curl from the browser console. #74

SimplGy opened this Issue Mar 21, 2012 · 4 comments


None yet
2 participants

SimplGy commented Mar 21, 2012

I think this is not allowed, but it would be great to know that for sure and be able to read a brief explanation of why. Is the console not allowed to add scripts? Does curl not have the same access to executing code in the console?


This works in an included JS module, but not from the console. Am I doing something wrong trying to run this in Chrome or Firefox's console?


unscriptable commented Mar 21, 2012

Hey @simpleascouldbe!

I see two minor issues with your code snippet.

  1. Anonymous modules only work if the loader can figure out the module id from the file name. Just add a module id and it'll work.

  2. The call to lightbox will execute immediately upon module definition. If you want a module that you can call repeatedly, you should have it return a function:

    define('myModule', ['components/lightbox'],function (lightbox){
    return function () {

Try that. :)

-- John

@ghost ghost assigned unscriptable Mar 21, 2012


unscriptable commented Mar 21, 2012

You are right. This needs to be documented. :)

SimplGy commented Mar 22, 2012

I was mixed up. I'm doing a single-page app that only bootstraps in once.

I got so used to starting views with a 'define' that I forgot the application actually used 'curl' to kick everything off.

This works just fine against an already-defined curl module:

curl(['components/lightbox'], function(lightbox){

I added a page to the wiki (couldn't figure out how to put it in the right category though). Hope it helps, feel free to edit or delete if it's not what you're looking for.

@SimplGy SimplGy closed this Mar 22, 2012


unscriptable commented Mar 22, 2012

Wow, thanks Eric! I'm going to add some very minor adjustments and put it on the main page! -- J

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment