Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#16405 closed defect (invalid)

Micro event API not working

Reported by: adros Owned by: Rawld Gill
Priority: undecided Milestone: 1.9
Component: Loader Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:

Description

Micro event api seems to be not working:

  1. cross browser
  2. as documented

I have a simple test case:

define([
	"require"
], function(_require) {

	require.on("error", handleAmdError);

	require([
		"foo/bar"
	], function() {
		console.log("foo/bar loaded");
	});
	

	function handleAmdError(error) {
		console.log(error);
	}
});

When I run it in Chrome, two errors are handled. First with message "scriptError", this on is not mentioned in docs, i would expect "xhrFailed" and second one with message "timeout". Same behaviour is in Firefox.

But when I run the test in IE(9), no event occurs.

Attachments (1)

bug16405.js (1.2 KB) - added by adros 6 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 7 years ago by Rawld Gill

Milestone: tbd1.9
Resolution: invalid
Status: newclosed

The root problem you are experiencing is that the loader is not catching an error.

At one point in its history, the loader caught and reported all errors. However, many thought it better to let the error propagate to the debugger. As a middle ground, it was decided to make the behavior configurable.

In order to get the effect you want, set the has feature "config-dojo-loader-catches" truthy; for example:

<script>
    var require = {
        has:{
            "config-dojo-loader-catches":1
        }
    };
</script>
<script src="dojo/dojo.js"></script>

comment:2 Changed 7 years ago by adros

I do not agree with you. 'config-dojo-loader-catches' would turn on catching of errors in factory. But this code will not rise any error:

require([
	"foo/bar"
], function() {
	console.log("foo/bar loaded");
});

Changed 6 years ago by adros

Attachment: bug16405.js added

comment:3 Changed 6 years ago by adros

I still consider this issue as valid (but I do not have rights to change state).

I have attached a DOH test (bug16405.js​), which works in latest Chrome and also IE10, but fails in IE9.

Note: See TracTickets for help on using tickets.