From 0234b479ab921e410a275db667be2bb913376690 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Mon, 8 Mar 2021 05:32:49 -0300 Subject: [PATCH] Add Debug breakpoints support (#17295) * Add Debug breakpoints support * Add Debug breakpoints support --- changelog.md | 2 ++ lib/js/jscore.nim | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/changelog.md b/changelog.md index 20177aefd..d0ad8e8e4 100644 --- a/changelog.md +++ b/changelog.md @@ -205,6 +205,8 @@ provided by the operating system. - Removed support for named procs in `sugar.=>` +- Added `jscore.debugger` to [call any available debugging functionality, such as breakpoints.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) + ## Language changes diff --git a/lib/js/jscore.nim b/lib/js/jscore.nim index 3af33b535..693e50799 100644 --- a/lib/js/jscore.nim +++ b/lib/js/jscore.nim @@ -13,6 +13,7 @@ ## specific requirements and solely targets JavaScript, you should be using ## the relevant functions in the `math`, `json`, and `times` stdlib ## modules instead. +import std/private/since when not defined(js): {.error: "This module only works on the JavaScript platform".} @@ -104,3 +105,8 @@ proc setFullYear*(d: DateTime, year: int) {.importcpp.} #JSON library proc stringify*(l: JsonLib, s: JsRoot): cstring {.importcpp.} proc parse*(l: JsonLib, s: cstring): JsRoot {.importcpp.} + + +since (1, 5): + func debugger*() {.importjs: "debugger@".} + ## https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger