diff --git a/src/entry_offline.js b/src/entry_offline.js index bc2b8a0fd..6bbaf58e7 100644 --- a/src/entry_offline.js +++ b/src/entry_offline.js @@ -43,6 +43,8 @@ global.sharedObject = { workingPath: '', isInitEntry: false, appName: 'entry', + hostURI: hostURI, + hostProtocol: hostProtocol }; function logger(text) { diff --git a/src/renderer/src/require.js b/src/renderer/src/require.js index e543c0077..c1703c533 100644 --- a/src/renderer/src/require.js +++ b/src/renderer/src/require.js @@ -40,6 +40,24 @@ const filbert = parser; import util from './src/sources/util'; const Util = util; +$.get = function(url, data, callback, type){ + if ( $.isFunction(data) ){ + type = type || callback, + callback = data, + data = {} + } + if(/^\//.test(url)) { + url = `${sharedObject.hostProtocol}//${sharedObject.hostURI}${url}`; + } + return $.ajax({ + url: url, + type: 'GET', + success: callback, + data: data, + contentType: type + }); +}; + document.fonts.ready.then(() => { try { if (Entry) {