Commit Graph

370 Commits

Author SHA1 Message Date
Fedor Indutny
47ef9adaab Fix build on napi-4 2021-05-19 15:49:31 -07:00
Fedor Indutny
b8ea71824b another fix 2021-05-19 15:26:20 -07:00
Fedor Indutny
43fdcd2d2d Fix build when napi-6 feature is absent 2021-05-19 15:21:43 -07:00
Fedor Indutny
d103220b3c use assert! 2021-05-19 14:17:12 -07:00
Fedor Indutny
4d3f846c60 Address review feedback 2021-05-19 13:13:09 -07:00
Fedor Indutny
84a8eb85c3 EventQueue:new() uses new threadsafe trampoline 2021-05-19 11:17:39 -07:00
Fedor Indutny
0ebf866254 Do ref counting in ThreadsafeTrampoline 2021-05-19 10:17:28 -07:00
Fedor Indutny
76853a9b6c Reuse ThreadsafeFunction in EventQueue
Node.js optimizes subsequent ThreadsafeFunction invocations to happen
during the same event loop tick, but only if the same instance of
ThreadsafeFunction is used. The performance improvement is most
noticeable when used in Electron, because scheduling a new UV tick in
Electron is very costly.

With this change EventQueue will use an
existing instance of ThreadsafeTrampoline (wrapper around
ThreadsafeFunction) if compiled with napi-6 feature, or it will fallback
to creating a new ThreadsafeFunction per EventQueue instance.

Fix: #727
2021-05-18 18:11:16 -07:00
David Herman
8758b7f416 API docs for the neon::types module top level. 2021-05-17 18:47:46 -07:00
David Herman
0df7033978 Use error message from PSD error on failure. 2021-05-14 17:39:35 -07:00
David Herman
3f6804c79f cargo fmt 2021-05-14 17:38:20 -07:00
David Herman
1e8d6261a4 Upgrade to Rust 2018 Edition 2021-05-14 11:25:31 -07:00
David Herman
56834b5afc Add initial section title, and some rewording of opening sentence 2021-05-14 02:11:32 -07:00
David Herman
b64f9203ab Delete trailing spaces 2021-05-14 02:06:21 -07:00
David Herman
5b20370bee Top level API docs for neon::event 2021-05-13 20:41:29 -07:00
Dave Herman
77f2ac06de
Fix CLI example in top level API docs
`neon init neon` -> `npm init neon` in main lib API docs
2021-05-01 09:31:46 -07:00
K.J. Valencik
fbd09f0bff
chore(neon): Drop support for Node 10 which is end of life 2021-04-30 12:43:07 -04:00
K.J. Valencik
d7ac291d97
chore(neon): Run all of the doc tests and run tests in debug mode 2021-04-28 15:41:08 -04:00
David Herman
859d531fe8 Remove unnecessary ignores. 2021-04-28 09:12:08 -07:00
David Herman
671add6f37 Fix broken code in doc examples. 2021-04-28 09:08:36 -07:00
David Herman
0ab1a9d52f Better links to context docs from result docs. 2021-04-27 17:02:53 -07:00
David Herman
d3a296928f Much more complete documentation on contexts. 2021-04-27 16:53:55 -07:00
David Herman
e302ab9e31 Mention idiomatic use of question mark operator. 2021-04-07 10:52:45 -07:00
David Herman
17a0ea921c Top-level module API docs for neon::result. 2021-04-07 10:46:05 -07:00
David Herman
5078b1714f Semantic links to stdlib. 2021-04-07 09:05:10 -07:00
David Herman
54c35c52b5 Align wording for all module top-level entries. 2021-04-06 17:57:53 -07:00
David Herman
01fe92123c Update Deref wording to be closer to the JsBox wording. 2021-04-06 17:17:04 -07:00
David Herman
ed3bb5392e Add section on the implementation of Deref. 2021-04-06 15:44:30 -07:00
David Herman
687fd06042 Top-level API docs for neon::handle. 2021-04-06 13:34:26 -07:00
David Herman
50827bee3d Add examples. 2021-04-05 10:51:12 -07:00
David Herman
0e270d1c7c Top level module API docs for the neon::context module. 2021-04-02 09:22:17 -07:00
Dave Herman
03c7e9e425
Merge pull request #705 from neon-bindings/api-docs
API docs: Neon root, module summaries, neon::borrow
2021-03-29 16:01:38 -07:00
David Herman
e860829dac Address feedback from @kjvalencik's review 2021-03-26 22:37:23 -07:00
Dave Herman
f4ec6eaa29
Apply suggestions from code review
Co-authored-by: K.J. Valencik <kjvalencik@gmail.com>
2021-03-26 19:16:02 -07:00
David Herman
96ff123914 Ignore code blocks in tests. 2021-03-26 18:52:01 -07:00
David Herman
3792dfd5c6 API docs for:
- main Neon root doc
- all module summaries
- `neon::borrow` module
2021-03-23 20:39:16 -07:00
K.J. Valencik
4c224560b6
review(neon): Address review feedback for the global drop queue 2021-03-19 13:47:53 -04:00
K.J. Valencik
194945ebc6
Lint fix 2021-03-16 15:54:35 -04:00
K.J. Valencik
3ab690e8f8
feat(neon): Add a drop queue for safely dropping Root without leaking on N-API 6+ 2021-03-16 15:54:32 -04:00
patr0nus
ccbc5916fe cargo fmt 2021-03-15 20:43:13 +08:00
patr0nus
64ee1659c2 Merge remote-tracking branch 'upstream/main' into main
# Conflicts:
#	crates/neon-runtime/src/napi/bindings/functions.rs
#	src/lib.rs
2021-03-14 23:52:32 +08:00
Wang, Chi
bd795eabae
Update mod.rs 2021-03-14 13:14:23 +08:00
patr0nus
397c734839 Move the run_script binding to neon::reflect::eval 2021-03-13 21:58:26 +08:00
patr0nus
2918268580 Merge remote-tracking branch 'upstream/main' into main
# Conflicts:
#	crates/neon-runtime/src/napi/bindings/functions.rs
2021-03-13 21:42:03 +08:00
K.J. Valencik
56b3715d7b
cargo fmt all the things! 2021-03-12 18:05:44 -05:00
K.J. Valencik
188c8d1852
Lint fixes 2021-03-12 18:05:15 -05:00
K.J. Valencik
0f7572ab00
Fix clippy lints in tests 2021-03-12 17:10:48 -05:00
K.J. Valencik
553650ada6
Fix all clippy lints except for clippy::missing_safety_doc
A couple of lints are ignored because they would be breaking changes to the API
2021-03-12 16:53:36 -05:00
K.J. Valencik
b0ff15ef97
feat(neon): Add Buffer::external and ArrayBuffer::external for creating buffers backed by Rust data 2021-03-11 14:42:11 -05:00
patr0nus
2e7a34a071 Add binding to napi_run_script 2021-03-07 19:25:30 +08:00