Uncaught TypeError: exists is not a function

654 views
Skip to first unread message

Evgeniy Martin

unread,
Oct 16, 2015, 4:25:45 AM10/16/15
to ceylon-users
when working with modules Ceylon from  JavaScript the program is running normally but in the console occurs error: Uncaught TypeError: exists is not a function.

file html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-type"
              content="text/html;charset=UTF-8"/>
        <title>Hello</title>
        <script type="text/javascript"
                src="script/require/1.0.8/require.js">
        </script>
        <script type="text/javascript">
            require.config({
                // location of our project's compiled modules
                baseUrl: 'modules',
                // locations of external dependencies here
                paths: {
                    // path to the Ceylon language module
                    'ceylon/language':
                        './script/ceylon/language'
                }
            });
            //alias our hello module to 'h'
            require(['testJavascript/1.0.0/testJavascript-1.0.0'],
                    function (testJavascript) { h=testJavascript; });
        </script>
    </head>
    <body>
        <div>
            <input type="submit"
                   value="Say hello"
                   onclick="h.run()"/>
        </div>
        <div>
            <span id="greeting"/>
        </div>
    </body>
</html>

module testJavascript:

    module.ceylon:
        module testJavascript "1.0.0" {}

    package.ceylon:
        shared package testJavascript;

    run.ceylon:
        "Run the module `testJavascript`."
        shared void run() {
             print("123");
        }

Stephane Epardaud

unread,
Oct 16, 2015, 4:54:34 AM10/16/15
to ceylon...@googlegroups.com
Can you check in the navigator logs that it loaded the language module js file?

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/2ab89252-aff9-4142-8b25-cdd641c584ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Evgeniy Martin

unread,
Oct 16, 2015, 6:47:50 AM10/16/15
to ceylon-users
Yes, I see it. but this occurs after the error:

file:///home/emartyn/workspace/MATHSDK/2222222/script/require/1.0.8/require.js
file:///home/emartyn/workspace/MATHSDK/2222222/modules/testJavascript/1.0.0/testJavascript-1.0.0.js
TypeError: exists is not a function require.js:12548:12
file:///home/emartyn/workspace/MATHSDK/2222222/modules/testJavascript/1.0.0/testJavascript-1.0.0-model.js
file:///home/emartyn/workspace/MATHSDK/2222222/modules/script/ceylon/language/1.1.0/ceylon.language-1.1.0.js
file:///home/emartyn/workspace/MATHSDK/2222222/modules/script/ceylon/language/1.1.0/ceylon.language-1.1.0-model.js


Stephane Epardaud

unread,
Oct 16, 2015, 8:17:42 AM10/16/15
to ceylon...@googlegroups.com
It seems to throw the error before even loading the language module, which is weird. My test loaded the module after the document was ready, can you try that to see if it makes any difference?

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Evgeniy Martin

unread,
Oct 19, 2015, 4:12:15 AM10/19/15
to ceylon-users
Your example has one warning:

file:///home/emartyn/workspace/MATHSDK/ceylon-demo-javaone-2013-client-master/ceylon-demo-javaone-2013-client-master/bootstrap.min.css
file:///home/emartyn/workspace/MATHSDK/ceylon-demo-javaone-2013-client-master/ceylon-demo-javaone-2013-client-master/main.css
file:///home/emartyn/workspace/MATHSDK/ceylon-demo-javaone-2013-client-master/ceylon-demo-javaone-2013-client-master/jquery-1.10.2.min.js
file:///home/emartyn/workspace/MATHSDK/ceylon-demo-javaone-2013-client-master/ceylon-demo-javaone-2013-client-master/require.js

Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery-1.10.2.min.js:1:0

file:///home/emartyn/workspace/MATHSDK/ceylon-demo-javaone-2013-client-master/ceylon-demo-javaone-2013-client-master/modules/client/1.0.0/client-1.0.0.js
file:///home/emartyn/workspace/MATHSDK/ceylon-demo-javaone-2013-client-master/ceylon-demo-javaone-2013-client-master/modules/client/1.0.0/client-1.0.0-model.js
file:///home/emartyn/.ceylon/cache/ceylon/language/1.1.0/ceylon.language-1.1.0.js
file:///home/emartyn/.ceylon/cache/ceylon/json/1.1.0/ceylon.json-1.1.0.js
file:///home/emartyn/.ceylon/cache/ceylon/json/1.1.0/ceylon.json-1.1.0-model.js
file:///home/emartyn/.ceylon/cache/ceylon/collection/1.1.0/ceylon.collection-1.1.0.js
file:///home/emartyn/.ceylon/cache/ceylon/language/1.1.0/ceylon.language-1.1.0-model.js
file:///home/emartyn/.ceylon/cache/ceylon/collection/1.1.0/ceylon.collection-1.1.0-model.js

what is the difference from the example on the site (http://ceylon-lang.org/blog/2013/02/26/ceylon-in-the-browser/)? require.js version or the location of a file or something else?


Enrique Zamudio

unread,
Oct 19, 2015, 10:25:47 AM10/19/15
to ceylon-users
Do you use the `exists` operator anywhere in your code? is it inside a dynamic block? Are you perhaps doing something like `exists(foo)`? That _could_ get turned into a call to a function named exists.
Reply all
Reply to author
Forward
0 new messages