-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a80e7e3
commit 2f7b715
Showing
12 changed files
with
646 additions
and
111 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"use strict"; | ||
|
||
const searchScripts = options => { | ||
return new Promise(async (resolve, reject) => { | ||
|
||
let url_encode = ""; | ||
for (let opt in options) { | ||
if (url_encode === "") { | ||
|
||
url_encode += "?"; | ||
} else { | ||
|
||
url_encode += "&"; | ||
} | ||
|
||
url_encode += `${opt}=${options[opt]}`; | ||
} | ||
|
||
const req = new XMLHttpRequest; | ||
req.open("GET", `/api/v3/scripts${url_encode}`); | ||
|
||
req.onreadystatechange = () => { | ||
if (req.readyState === 4) { | ||
|
||
const res_json = JSON.parse(req.response); | ||
|
||
if (res_json instanceof Array === true) { | ||
|
||
resolve(res_json); | ||
} else { | ||
|
||
reject(res_json); | ||
} | ||
} | ||
} | ||
|
||
req.send(); | ||
}); | ||
} |
Oops, something went wrong.