1

So I am digging through the WebOS enyo framework and am getting very frustrated. I am currently getting the following error in my log. I have been looking at the samples in the framework and I just can't seem to find where the error is stemming from. It's been over a decade since I have done any HTML or js and what I did back then was very basic stuff. Any help would be appreciated

Uncaught ReferenceError: Learning is not defined, index.html:9

Here is the very simple application, I am currently just attempting to get elements to appear on screen.

Index.html

<!doctype html />
<html>
<head>
    <title>Learning</title>
    <script src="../../enyo/1.0/framework/enyo.js" type="text/javascript"></script>
</head>
<body>
    <script type="text/javascript">
       new MyApps.Learning().renderInto(document.body);
</script>
</body>
</html>

Learning.js

enyo.kind({
    name: "MyApps.Learning",
    kind: enyo.VFlexBox,
    components: [
        { kind: "Scrim",
            layoutKind: "VFlexLayout",
            align: "center",
            pack: "center",
            components: [
                {kind: "SpinnerLarge"}
            ]
        }
    ]
});

depends.js

enyo.depends(
    "source/Learning.js",
    "css/Learning.css"
);

and just for the heck of it the

appinfo.json

file

{
    "id": "com.myapps.learning",
    "uiRevision": "2",
    "version": "1.0.0",
    "vendor": "kizelli",
    "type": "web",
    "main": "index.html",
    "title": "Learning"
}
Community
  • 1
  • 1
James West
  • 771
  • 1
  • 14
  • 26

3 Answers3

1

I think this is a problem in your appinfo.json file...

You hold the id as: com.myapps.learning

Yet you reference it as myapps.learning, try either removing the com. from appinfo.json or adding it to your kind definition and your index.html

diagonalbatman
  • 17,340
  • 3
  • 31
  • 31
0

This usually appears when you got something wrong in your Learning.js. I am not quiet sure, but you could try:

enyo.kind({
    name: "MyApps.Learning",
    kind: enyo.VFlexBox,
    components: [
        {kind: "Scrim",
         layoutKind: "VFlexLayout",
         align: "center",
         pack: "center",
         components: [
                {kind: "SpinnerLarge"}
            ]
        }
    ]
});
takrl
  • 6,356
  • 3
  • 60
  • 69
0

In my experience, this problem occurs when the path to enyo.js is wrong. I had an older copy of the SDK/emulator, so enyo.js was not found at the path I had copied from the tutorial. Upgrading the SDK fixed it for me, but you can probably ssh into your emulator to find the correct path.

if enyo is not loaded, it won't be able to created any kinds (MyApps.Learning) you've created.

I was kind of disappointed that there were no errors logged when enyo was not found or didn't load....

Matt
  • 107
  • 1
  • 3