My dart2js compiled Chrome Packaged App crashes with Uncaught Error: Instance of 'UnknownJavaScriptObject' and ReferenceError: DartObject is not defined.
The full stack trace follows
Uncaught Error: Instance of 'UnknownJavaScriptObject' echo_mco.dart.js:7913
Stack Trace:
ReferenceError: DartObject is not defined
at dart._convertToDart (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:7422:34)
at JsObject.$index (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:7449:16)
at dart.J.$index$asx (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:8496:41)
at chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:8874:12
at Isolate.prototype.(anonymous function) (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:9412:37)
at chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:8871:25
at Isolate.prototype.(anonymous function) (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:9412:37)
at RawDatagramSocket_bind_closure.call$0 (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:3079:14)
at dart.Future_Future$sync (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:3381:28)
at dart.RawDatagramSocket.static.RawDatagramSocket_bind (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:3070:18)
This is caused by the interop.js script not being included properly. It must be included as
<script src="packages/browser/interop.js"></script>
and it must precede all other Dart related JavaScript includes. So the includes may for example look like this
<script src="packages/browser/interop.js"></script>
<script type="application/dart">export 'package:polymer/init.dart';</script>
<script src="packages/browser/dart.js"></script>
In a Chrome Packaged App that uses the chrome package the includes may look like this
<script src="packages/browser/interop.js"></script>
<script src="packages/chrome/bootstrap.js" defer></script>
<script src="echo_mco.dart" type="application/dart"></script>
The problem was being discussed and solved at https://code.google.com/p/dart/issues/detail?id=15065
Related
Here’s what I do in an ordinary html file.
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/test.js"></script>
Now, I’d like to see this reflected in WordPress. So in my functions.php I do this:
function theme_files(){
wp_enqueue_script('jquery',get_theme_file_uri('js/jquery-3.3.1.slim.min.js'),NULL,'1.0',true);
wp_enqueue_script('popper',get_theme_file_uri('js/popper.min.js'),NULL,'1.0',true);
wp_enqueue_script('bootstrap',get_theme_file_uri('js/bootstrap.min.js'),NULL,'1.0',true);
wp_enqueue_script('ui',get_theme_file_uri('js/jquery-ui.min.js'),NULL,'1.0',true);
wp_enqueue_script('ownJS',get_theme_file_uri('js/scripts.js'), array('jquery'), '1.0',true);
}
add_action('wp_enqueue_scripts','theme_files');
Unfortunately it doesn’t work. I already found out that its not the dependency in my own js (scripts.js). It doen’t matter whether I do NULL or array(‚jquery‘). Also, I tried to only enqueue my own js without the others. Doen’t seem to change a thing.
Suprisingly, when I do alert(’test’); in my scripts.js it does pop up. But when I do
$(„#idOne“).click(function(){
alert(‚hello‘);
});
Nothing happens when I click on the element with the id=„idOne“
Even when I do pure js
function sayHi(){
alert(‚Hi‘);
}
var one = document.getElementByID(‚idOne‘);
one.addEventListener(‚click‘,sayHi, false);
it doesn’t do a thing ether. What do I do wrong?
Thanks!
I'm using Linkedin Follow Company plugin
and I jave defined the language (Danish) by doing this
<script src="https://platform.linkedin.com/in.js" type="text/javascript"> lang: da_DK</script>
<script type="IN/FollowCompany" data-id="1337" data-counter="bottom"></script>
But it can't output the "Ø" in Følg, but instead outputs a weird character:
Anyone know if the label is overridable somehow or could provide a solution?
The following has occurred:
ReferenceError: anputAccept is not defined]
<script type="text/javascript" src="tshirt1.js"></script> <--this is failing to load.
I have created a .js file that has a method in it named anputAccept. This is located within Script tags in HTML at the bottom of the body tags.
document.getElementById("pushme").addEventListener("click",inputAccept);
The actual method is set like this in .js
function anputAccept() { //Statements here };
Can anyone explain exactly what is going on, and why the script fails to run? Why is there a Reference Error? This is caused because the script fails to load?
Put <script type="text/javascript" src="tshirt1.js"></script> to the bottom of the HTML page or you can you can try this:
window.onload = function() {
document.getElementById("pushme").addEventListener("click",inputAccept);
};
There are similar questions like mine, but they couldn't help me out.
html:
<!DOCTYPE html>
<html>
<head>
<title>Test-Site</title>
<script src="scripts/angular.js"></script>
<script src="scripts/angular-route.js"></script>
<script src="~/App_Data/mainApp.js"></script>
<script src="~/Controllers/testController.js"></script>
</head>
<body>
<div ng-app="~/App_Data/mainApp" ng- controller="~/Controllers/testController">
Write your Name:<input type="text" ng-model="name.firstName" />
Your Name: {{name.firstName}}
</div>
main.app.js:
var mainApp = angular.module("mainApp", []);
test.controller.js:
mainApp.controller("testController", function ($scope) {
$scope.name = { firstName: "Peter" };
});
Chrome console gives me following errors:
Test.html:8 GET http://localhost:55835/~/Controllers/testController.js
Test.html:7 GET http://localhost:55835/~/App_Data/mainApp.js
angular.js:63 Uncaught Error: [$injector:modulerr] Failed to instantiate module ~/App_Data/mainApp due to:
Error: [$injector:nomod] Module '~/App_Data/mainApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Everything was fine, until I moved the js-files into their folders.
What am I doing wrong?
You are using the server side path ~/ in a client side page. You cannot use the server side path in this way. You need to provide the full path from the root of the site to your files; most likely, just removing the ~/ will be enough.
As a side note, normally the App_Data folder is for things like Database files and other server resources; it seems an odd place to put your mainApp.js file.
I'm trying to upgrade Uvumidropdown menu for use with MooTools 1.3.2 or 1.4.1 so that I can use a MooTool slider as well. The first thing I did was to replace the mootools call to a "mootools-dropdown.js" with a call to "mootools-1.2.5.js" given that the contents of "mootools-dropdown.js" begins with
var MooTools={version:"1.2.0",build:""};var Native=function(J)...
so obviously this is a MooTool core file. I did this to troubleshoot the menu, and make sure that the core file was not a custom file.
<script type="text/javascript" src="js/mootools-1.2.5-core-yc.js"> </script>
<script type="text/javascript" src="xjs/mootools-dropdown.js"> </script>
<script type="text/javascript" src="js/UvumiDropdown-compressed.js"> </script>
<script type="text/javascript">
window.addEvent('domready', function () {
var menu = new UvumiDropdown('dropdown-demo');
});
As it happens, the dropdown menu does not work with 1.2.5.
Is my presumption that the menu should work with 1.2.5 incorrect?
My findings lead me to believe that the mootools core file has been customized, but I have no way to compare it with an original 1.2.0 file.