Opened 8 years ago

Closed 5 years ago

Last modified 5 years ago

#14063 closed enhancement (fixed)

dojo.io.script support delayed callbacks or throw error

Reported by: hurrymaplelad Owned by: Bryan Forbes
Priority: high Milestone: 1.8
Component: IO Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

Full example loading google maps here: http://stackoverflow.com/questions/7438854/loading-google-maps-api-v3-asynchronously-with-dojo-io-script-fails-silently

JSFiddle Example: http://jsfiddle.net/sKNmS/

It appears that dojo.io.script.get() expects the immediately returned script to call the JSONP callback. In the google maps example, the loaded script does some additional work (loads more files) before calling the global callback. By then, dojo.io.script has removed its global callback, and neither the load nor the error callback is invoked.

Ideally dojo.io.script will support the google maps delayed callback. If that's deemed outside io.script's scope, at least call the error callback and let me know that the loaded script didn't call the expected jsonp callback.

Change History (4)

comment:1 Changed 7 years ago by bill

Owner: changed from James Burke to Bryan Forbes

Bulk change to reassign IO tickets to Bryan, since he is working on new dojo/request module. Some of these tickets should probably be closed as already fixed, invalid, or wontfix.

comment:2 Changed 7 years ago by bishop

I think this one can be closed. This seems to work properly in 1.8.0:

// Script is required from 'dojo/request/script'
Script.get(
    '//maps.google.com/maps/api/js?v=3&sensor=false',
    { jsonp:'callback' }
).then(
    function (data) {
        window.console.log(window.google);
    },
    function (err) {
        window.console.log('Whoops' + err);
    }
);

comment:3 Changed 5 years ago by Bryan Forbes

Resolution: fixed
Status: newclosed

Since it has been reported as fixed, I'm marking as such.

comment:4 Changed 5 years ago by bill

Milestone: tbd1.8
Note: See TracTickets for help on using tickets.