MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / loadRemote

Function loadRemote

scripts/transifex.mjs:139–171  ·  view source on GitHub ↗
(lang)

Source from the content-addressed store, hash-verified

137}
138
139async function loadRemote(lang) {
140 let { resp, result } = await request('/resource_translations_async_downloads', {
141 method: 'POST',
142 body: {
143 data: {
144 type: 'resource_translations_async_downloads',
145 attributes: {
146 mode: 'onlytranslated',
147 },
148 relationships: {
149 language: {
150 data: {
151 id: `l:${lang}`,
152 type: 'languages',
153 },
154 },
155 resource: {
156 data: {
157 id: RESOURCE_ID,
158 type: 'resources',
159 },
160 },
161 },
162 },
163 },
164 });
165 while (!resp.redirected && ['pending', 'processing', 'succeeded'].includes(result.data.attributes.status)) {
166 await delay(500);
167 ({ resp, result } = await request(`/resource_translations_async_downloads/${result.data.id}`));
168 }
169 if (!resp.redirected) throw { resp, result };
170 return result;
171}
172
173async function getTranslations(lang) {
174 let { result } = await request('/resource_translations', {

Callers 1

transifex.mjsFile · 0.85

Calls 2

requestFunction · 0.85
delayFunction · 0.85

Tested by

no test coverage detected