#typescript
This repository offers many practical JavaScript/TypeScript examples for learning AI development, requiring Node.js and Bun runtimes. It includes ready-to-run demos like conversation summarization, web search integration, memory management, and API interactions with services like OpenAI, Langfuse, and Qdrant. You can run these examples locally or via Docker for easy setup. The code covers advanced AI topics such as token counting, prompt engineering, vector databases, and audio/video processing. Using Bun, a fast and TypeScript-friendly runtime compatible with Node.js, enhances performance and development speed. This setup helps you quickly experiment with AI features and build your own AI-powered apps efficiently.
https://github.com/i-am-alice/3rd-devs
🚀 Вышел стабильный 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