Remove define for jsfetch (#19530)

* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch

* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch

* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch

* Remove define nimExperimentalAsyncjsThen for std/asyncjs.then and std/jsfetch
This commit is contained in:
Juan Carlos 2022-02-25 11:34:16 -08:00 • committed by GitHub
commit f0bfc0bd3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 84 deletions

View file

@ -40,7 +40,7 @@ becomes an alias for `addr`.
- Added `std/oserrors` for OS error reporting. Added `std/envvars` for environment variables handling. - Added `std/oserrors` for OS error reporting. Added `std/envvars` for environment variables handling.
- Removed deprecated `oids.oidToString`. - Removed deprecated `oids.oidToString`.
- Remove define `nimExperimentalAsyncjsThen` for `std/asyncjs.then` and `std/jsfetch`.
- Changed mimedb to use an `OrderedTable` instead of `OrderedTableRef`, to use it in a const. - Changed mimedb to use an `OrderedTable` instead of `OrderedTableRef`, to use it in a const.
- Removed deprecated `jsre.test` and `jsre.toString`. - Removed deprecated `jsre.test` and `jsre.toString`.

View file

@ -64,6 +64,7 @@ when not defined(js) and not defined(nimsuggest):
import std/jsffi import std/jsffi
import std/macros import std/macros
import std/private/since
type type
Future*[T] = ref object Future*[T] = ref object
@ -163,8 +164,7 @@ template maybeFuture(T): untyped =
when T is Future: T when T is Future: T
else: Future[T] else: Future[T]
when defined(nimExperimentalAsyncjsThen):
import std/private/since
since (1, 5, 1): since (1, 5, 1):
#[ #[
TODO: TODO:
@ -187,7 +187,7 @@ when defined(nimExperimentalAsyncjsThen):
proc then*[T](future: Future[T], onSuccess: proc, onReject: OnReject = nil): auto = proc then*[T](future: Future[T], onSuccess: proc, onReject: OnReject = nil): auto =
## See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then ## See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then
## Returns a `Future` from the return type of `onSuccess(T.default)`. ## Returns a `Future` from the return type of `onSuccess(T.default)`.
runnableExamples("-d:nimExperimentalAsyncjsThen"): runnableExamples("-r:off"):
from std/sugar import `=>` from std/sugar import `=>`
proc fn(n: int): Future[int] {.async.} = proc fn(n: int): Future[int] {.async.} =
@ -233,7 +233,7 @@ when defined(nimExperimentalAsyncjsThen):
proc catch*[T](future: Future[T], onReject: OnReject): Future[void] = proc catch*[T](future: Future[T], onReject: OnReject): Future[void] =
## See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch ## See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
runnableExamples("-d:nimExperimentalAsyncjsThen"): runnableExamples("-r:off"):
from std/sugar import `=>` from std/sugar import `=>`
from std/strutils import contains from std/strutils import contains

View file

@ -190,7 +190,6 @@ runnableExamples("-r:off"):
discard example() discard example()
when defined(nimExperimentalAsyncjsThen):
block: block:
proc example2 {.async.} = proc example2 {.async.} =
await fetch("https://api.github.com/users/torvalds".cstring) await fetch("https://api.github.com/users/torvalds".cstring)

View file

@ -11,7 +11,7 @@ const
gaCode* = " --doc.googleAnalytics:UA-48159761-1" gaCode* = " --doc.googleAnalytics:UA-48159761-1"
# errormax: subsequent errors are probably consequences of 1st one; a simple # errormax: subsequent errors are probably consequences of 1st one; a simple
# bug could cause unlimited number of errors otherwise, hard to debug in CI. # bug could cause unlimited number of errors otherwise, hard to debug in CI.
docDefines = "-d:nimExperimentalAsyncjsThen -d:nimExperimentalLinenoiseExtra" docDefines = "-d:nimExperimentalLinenoiseExtra"
nimArgs = "--errormax:3 --hint:Conf:off --hint:Path:off --hint:Processing:off --hint:XDeclaredButNotUsed:off --warning:UnusedImport:off -d:boot --putenv:nimversion=$# $#" % [system.NimVersion, docDefines] nimArgs = "--errormax:3 --hint:Conf:off --hint:Path:off --hint:Processing:off --hint:XDeclaredButNotUsed:off --warning:UnusedImport:off -d:boot --putenv:nimversion=$# $#" % [system.NimVersion, docDefines]
gitUrl = "https://github.com/nim-lang/Nim" gitUrl = "https://github.com/nim-lang/Nim"
docHtmlOutput = "doc/html" docHtmlOutput = "doc/html"