Skip to content

Commit

Permalink
[1.6.11] jquery get method override
Browse files Browse the repository at this point in the history
- API 블럭은 서버에 데이터를 요청해야 하는 경우가 있는데,
  /로 시작하는 경우 일렉트론에서 파일경로로 인식하므로 이때 url 로 치환
  • Loading branch information
extracold1209 committed Aug 22, 2018
1 parent 14d1479 commit e3a4a72
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/entry_offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ global.sharedObject = {
workingPath: '',
isInitEntry: false,
appName: 'entry',
hostURI: hostURI,
hostProtocol: hostProtocol
};

function logger(text) {
Expand Down
18 changes: 18 additions & 0 deletions src/renderer/src/require.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e3a4a72

Please sign in to comment.