#c_lang
ESP-IDF is Espressif's official software framework for developing applications on ESP32 and related chips, supporting Windows, Linux, and macOS. It offers a complete set of tools, libraries, and drivers for Wi-Fi, Bluetooth, and IoT features, enabling you to build connected devices efficiently using C or C++. ESP-IDF supports multiple chip versions with stable releases and ongoing updates, ensuring reliability and production readiness. It includes easy commands for building, flashing, and monitoring your projects, plus example templates to start quickly. Using ESP-IDF helps you create robust, feature-rich IoT applications with strong community and official support. This saves time and effort in development and deployment.
https://github.com/espressif/esp-idf
🚀 Вышел стабильный JavaScript движок от Google для Android
Новая стабильная библиотека Jetpack JavaScript Engine позволит разработчикам выполнять JS код в изолированной и ограниченной среде.
class MainActivity : ComponentActivity() {
// Теперь nullable, без lateinit
private var jsSandbox: JavaScriptSandbox? = null
private var jsIsolate: JavaScriptIsolate? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (!JavaScriptSandbox.isSupported()) {
Log.e("JS", "JavaScriptSandbox не поддерживается")
return
}
lifecycleScope.launch {
// Создаём и сохраняем в nullable-поле
jsSandbox = JavaScriptSandbox
.createConnectedInstanceAsync(applicationContext)
.await()
jsIsolate = jsSandbox?.createIsolate()
// При выполнении гарантируем, что jsIsolate != null
val result: String = jsIsolate
?.evaluateJavaScriptAsync(JS_SCRIPT_SCRING)
?.await()
?: "Ошибка: isolate не инициализирован"
Log.d("JS", "Результат выполнения: $result")
}
}
override fun onDestroy() {
super.onDestroy()
// Закрываем только если не null
jsIsolate?.close()
jsSandbox?.close()
}
}
#jetpack#js