| 169 | } |
| 170 | |
| 171 | Result<JavaScriptFile> Bundle::getJs(const StringBox& jsPath) { |
| 172 | std::lock_guard<std::recursive_mutex> guard(_mutex); |
| 173 | const auto& it = _jsFilesByPath.find(jsPath); |
| 174 | if (it != _jsFilesByPath.end()) { |
| 175 | return it->second; |
| 176 | } |
| 177 | |
| 178 | auto key = jsPath.append(".js"); |
| 179 | auto entryResult = getEntry(key); |
| 180 | if (!entryResult) { |
| 181 | return entryResult.moveError(); |
| 182 | } |
| 183 | |
| 184 | auto entry = entryResult.moveValue(); |
| 185 | |
| 186 | auto jsFile = JavaScriptFile(entryResult.value(), StringBox::emptyString()); |
| 187 | |
| 188 | _jsFilesByPath[jsPath] = jsFile; |
| 189 | |
| 190 | return jsFile; |
| 191 | } |
| 192 | |
| 193 | std::vector<StringBox> Bundle::getAllEntryPaths() { |
| 194 | std::lock_guard<std::recursive_mutex> guard(_mutex); |