I tried to create web components directly from JavaScript, but I encountered an issue where the public constructor could not be found. Here's a basic example to illustrate the situation:
The HTML Template:
<polymer-element name="wc-foo" constructor="Foo" noscript>
<template>
Hello World!
</template>
</polymer-element>
HTML index:
<html>
<head>
<script src="general/scripts/polymer/polymer.min.js"></script>
<link rel="import" href="...">
</head>
<body>
</body>
<script>
console.log (window); // (1)
console.log (window.Foo); // (2)
var foo = new Foo (); // (3)
</script>
</html>
Console Results:
(1) When checking the window object, the constructor function for Foo is present: function (){return f(a)} (2) However, accessing window.Foo returns undefined. (3) Consequently, the attempt to instantiate new Foo() results in an error: Uncaught ReferenceError: Foo is not defined.
If anyone can offer insight into what might be causing this issue, I would greatly appreciate it. Thank you.