| 2199 | } |
| 2200 | } |
| 2201 | }); |
| 2202 | } |
| 2203 | return callContext.getContext().newUndefined(); |
| 2204 | } |
| 2205 | |
| 2206 | JSValueRef JavaScriptRuntime::runtimeSetColorPalette(JSFunctionNativeCallContext& callContext) { |
| 2207 | if (!_isWorker) { |
| 2208 | auto colorPaletteMap = callContext.getParameterAsValue(0); |
| 2209 | CHECK_CALL_CONTEXT(callContext); |
| 2210 | |
| 2211 | dispatchOnMainThread([weakSelf = weakRef(this), colorPaletteMap = std::move(colorPaletteMap)]() { |
| 2212 | auto self = weakSelf.lock(); |
| 2213 | if (self != nullptr) { |
| 2214 | if (auto listener = self->getListener()) { |
| 2215 | listener->configureColorPalette(STRING_LITERAL("default"), colorPaletteMap); |
| 2216 | listener->setActiveColorPalette(STRING_LITERAL("default")); |
| 2217 | } |
| 2218 | } |
| 2219 | }); |
| 2220 | } |
| 2221 | return callContext.getContext().newUndefined(); |
| 2222 | } |