@@ -34,8 +34,8 @@ class Example : public Napi::ObjectWrap<Example> {
34
34
Napi::Object Example::Init(Napi::Env env, Napi::Object exports) {
35
35
// This method is used to hook the accessor and method callbacks
36
36
Napi::Function func = DefineClass(env, "Example", {
37
- InstanceMethod("GetValue", &Example::GetValue),
38
- InstanceMethod("SetValue", &Example::SetValue)
37
+ InstanceMethod< &Example::GetValue>("GetValue" ),
38
+ InstanceMethod< &Example::SetValue>("SetValue" )
39
39
});
40
40
41
41
// Create a peristent reference to the class constructor. This will allow
@@ -289,6 +289,93 @@ One or more of `napi_property_attributes`.
289
289
Returns `Napi::PropertyDescriptor` object that represents a static method of a
290
290
JavaScript class.
291
291
292
+ ### StaticMethod
293
+
294
+ Creates property descriptor that represents a static method of a JavaScript class.
295
+
296
+ ```cpp
297
+ template <StaticVoidMethodCallback method>
298
+ static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(const char* utf8name,
299
+ napi_property_attributes attributes = napi_default,
300
+ void* data = nullptr);
301
+ ```
302
+
303
+ - ` [in] method ` : The native function that represents a static method of a
304
+ JavaScript class. This function returns nothing.
305
+ - ` [in] utf8name ` : Null-terminated string that represents the name of a static
306
+ method for the class.
307
+ - ` [in] attributes ` : The attributes associated with a particular property.
308
+ One or more of ` napi_property_attributes ` .
309
+ - ` [in] data ` : User-provided data passed into method when it is invoked.
310
+
311
+ Returns ` Napi::PropertyDescriptor ` object that represents the static method of a
312
+ JavaScript class.
313
+
314
+ ### StaticMethod
315
+
316
+ Creates property descriptor that represents a static method of a JavaScript class.
317
+
318
+ ``` cpp
319
+ template <StaticMethodCallback method>
320
+ static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod (const char* utf8name,
321
+ napi_property_attributes attributes = napi_default,
322
+ void* data = nullptr);
323
+ ```
324
+
325
+ - `[in] method`: The native function that represents a static method of a
326
+ JavaScript class.
327
+ - `[in] utf8name`: Null-terminated string that represents the name of a static
328
+ method for the class.
329
+ - `[in] attributes`: The attributes associated with a particular property.
330
+ One or more of `napi_property_attributes`.
331
+ - `[in] data`: User-provided data passed into method when it is invoked.
332
+
333
+ Returns `Napi::PropertyDescriptor` object that represents a static method of a
334
+ JavaScript class.
335
+
336
+ ### StaticMethod
337
+
338
+ Creates property descriptor that represents a static method of a JavaScript class.
339
+
340
+ ```cpp
341
+ template <StaticVoidMethodCallback method>
342
+ static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(Symbol name,
343
+ napi_property_attributes attributes = napi_default,
344
+ void* data = nullptr);
345
+ ```
346
+
347
+ - ` [in] method ` : The native function that represents a static method of a
348
+ JavaScript class.
349
+ - ` [in] name ` : Napi: Symbol that represents the name of a static
350
+ method for the class.
351
+ - ` [in] attributes ` : The attributes associated with a particular property.
352
+ One or more of ` napi_property_attributes ` .
353
+ - ` [in] data ` : User-provided data passed into method when it is invoked.
354
+
355
+ Returns ` Napi::PropertyDescriptor ` object that represents the static method of a
356
+ JavaScript class.
357
+
358
+ ### StaticMethod
359
+
360
+ Creates property descriptor that represents a static method of a JavaScript class.
361
+
362
+ ``` cpp
363
+ template <StaticMethodCallback method>
364
+ static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod (Symbol name,
365
+ napi_property_attributes attributes = napi_default,
366
+ void* data = nullptr);
367
+ ```
368
+
369
+ - `[in] method`: The native function that represents a static method of a
370
+ JavaScript class.
371
+ - `[in] name`: Napi:Symbol that represents the name of a static.
372
+ - `[in] attributes`: The attributes associated with a particular property.
373
+ One or more of `napi_property_attributes`.
374
+ - `[in] data`: User-provided data passed into method when it is invoked.
375
+
376
+ Returns `Napi::PropertyDescriptor` object that represents a static method of a
377
+ JavaScript class.
378
+
292
379
### StaticAccessor
293
380
294
381
Creates property descriptor that represents a static accessor property of a
@@ -342,6 +429,57 @@ is invoked.
342
429
Returns `Napi::PropertyDescriptor` object that represents a static accessor
343
430
property of a JavaScript class.
344
431
432
+ ### StaticAccessor
433
+
434
+ Creates property descriptor that represents a static accessor property of a
435
+ JavaScript class.
436
+
437
+ ```cpp
438
+ template <StaticGetterCallback getter, StaticSetterCallback setter=nullptr>
439
+ static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor(const char* utf8name,
440
+ napi_property_attributes attributes = napi_default,
441
+ void* data = nullptr);
442
+ ```
443
+
444
+ - ` [in] getter ` : The native function to call when a get access to the property of
445
+ a JavaScript class is performed.
446
+ - ` [in] setter ` : The native function to call when a set access to the property of
447
+ a JavaScript class is performed.
448
+ - ` [in] utf8name ` : Null-terminated string that represents the name of a static
449
+ accessor property for the class.
450
+ - ` [in] attributes ` : The attributes associated with a particular property.
451
+ One or more of ` napi_property_attributes ` .
452
+ - ` [in] data ` : User-provided data passed into getter or setter when
453
+ is invoked.
454
+
455
+ Returns ` Napi::PropertyDescriptor ` object that represents a static accessor
456
+ property of a JavaScript class.
457
+
458
+ ### StaticAccessor
459
+
460
+ Creates property descriptor that represents a static accessor property of a
461
+ JavaScript class.
462
+
463
+ ``` cpp
464
+ template <StaticGetterCallback getter, StaticSetterCallback setter=nullptr >
465
+ static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor (Symbol name,
466
+ napi_property_attributes attributes = napi_default,
467
+ void* data = nullptr);
468
+ ```
469
+
470
+ - `[in] getter`: The native function to call when a get access to the property of
471
+ a JavaScript class is performed.
472
+ - `[in] setter`: The native function to call when a set access to the property of
473
+ a JavaScript class is performed.
474
+ - `[in] name`: Napi:Symbol that represents the name of a static accessor.
475
+ - `[in] attributes`: The attributes associated with a particular property.
476
+ One or more of `napi_property_attributes`.
477
+ - `[in] data`: User-provided data passed into getter or setter when
478
+ is invoked.
479
+
480
+ Returns `Napi::PropertyDescriptor` object that represents a static accessor
481
+ property of a JavaScript class.
482
+
345
483
### InstanceMethod
346
484
347
485
Creates property descriptor that represents an instance method of a JavaScript class.
@@ -430,6 +568,94 @@ One or more of `napi_property_attributes`.
430
568
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
431
569
JavaScript class.
432
570
571
+ ### InstanceMethod
572
+
573
+ Creates property descriptor that represents an instance method of a JavaScript class.
574
+
575
+ ```cpp
576
+ template <InstanceVoidMethodCallback method>
577
+ static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(const char* utf8name,
578
+ napi_property_attributes attributes = napi_default,
579
+ void* data = nullptr);
580
+ ```
581
+
582
+ - ` [in] method ` : The native function that represents an instance method of a
583
+ JavaScript class.
584
+ - ` [in] utf8name ` : Null-terminated string that represents the name of an instance
585
+ method for the class.
586
+ - ` [in] attributes ` : The attributes associated with a particular property.
587
+ One or more of ` napi_property_attributes ` .
588
+ - ` [in] data ` : User-provided data passed into method when it is invoked.
589
+
590
+ Returns ` Napi::PropertyDescriptor ` object that represents an instance method of a
591
+ JavaScript class.
592
+
593
+ ### InstanceMethod
594
+
595
+ Creates property descriptor that represents an instance method of a JavaScript class.
596
+
597
+ ``` cpp
598
+ template <InstanceMethodCallback method>
599
+ static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod (const char* utf8name,
600
+ napi_property_attributes attributes = napi_default,
601
+ void* data = nullptr);
602
+ ```
603
+
604
+ - `[in] method`: The native function that represents an instance method of a
605
+ JavaScript class.
606
+ - `[in] utf8name`: Null-terminated string that represents the name of an instance
607
+ method for the class.
608
+ - `[in] attributes`: The attributes associated with a particular property.
609
+ One or more of `napi_property_attributes`.
610
+ - `[in] data`: User-provided data passed into method when it is invoked.
611
+
612
+ Returns `Napi::PropertyDescriptor` object that represents an instance method of a
613
+ JavaScript class.
614
+
615
+ ### InstanceMethod
616
+
617
+ Creates property descriptor that represents an instance method of a JavaScript class.
618
+
619
+ ```cpp
620
+ template <InstanceVoidMethodCallback method>
621
+ static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(Napi::Symbol name,
622
+ napi_property_attributes attributes = napi_default,
623
+ void* data = nullptr);
624
+ ```
625
+
626
+ - ` [in] method ` : The native function that represents an instance method of a
627
+ JavaScript class.
628
+ - ` [in] name ` : The ` Napi::Symbol ` object whose value is used to identify the
629
+ instance method for the class.
630
+ - ` [in] attributes ` : The attributes associated with a particular property.
631
+ One or more of ` napi_property_attributes ` .
632
+ - ` [in] data ` : User-provided data passed into method when it is invoked.
633
+
634
+ Returns ` Napi::PropertyDescriptor ` object that represents an instance method of a
635
+ JavaScript class.
636
+
637
+ ### InstanceMethod
638
+
639
+ Creates property descriptor that represents an instance method of a JavaScript class.
640
+
641
+ ``` cpp
642
+ template <InstanceMethodCallback method>
643
+ static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod (Napi::Symbol name,
644
+ napi_property_attributes attributes = napi_default,
645
+ void* data = nullptr);
646
+ ```
647
+
648
+ - `[in] method`: The native function that represents an instance method of a
649
+ JavaScript class.
650
+ - `[in] name`: The `Napi::Symbol` object whose value is used to identify the
651
+ instance method for the class.
652
+ - `[in] attributes`: The attributes associated with a particular property.
653
+ One or more of `napi_property_attributes`.
654
+ - `[in] data`: User-provided data passed into method when it is invoked.
655
+
656
+ Returns `Napi::PropertyDescriptor` object that represents an instance method of a
657
+ JavaScript class.
658
+
433
659
### InstanceAccessor
434
660
435
661
Creates property descriptor that represents an instance accessor property of a
@@ -482,6 +708,56 @@ One or more of `napi_property_attributes`.
482
708
Returns `Napi::PropertyDescriptor` object that represents an instance accessor
483
709
property of a JavaScript class.
484
710
711
+ ### InstanceAccessor
712
+
713
+ Creates property descriptor that represents an instance accessor property of a
714
+ JavaScript class.
715
+
716
+ ```cpp
717
+ template <InstanceGetterCallback getter, InstanceSetterCallback setter=nullptr>
718
+ static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceAccessor(const char* utf8name,
719
+ napi_property_attributes attributes = napi_default,
720
+ void* data = nullptr);
721
+ ```
722
+
723
+ - ` [in] getter ` : The native function to call when a get access to the property of
724
+ a JavaScript class is performed.
725
+ - ` [in] setter ` : The native function to call when a set access to the property of
726
+ a JavaScript class is performed.
727
+ - ` [in] utf8name ` : Null-terminated string that represents the name of an instance
728
+ accessor property for the class.
729
+ - ` [in] attributes ` : The attributes associated with the particular property.
730
+ One or more of ` napi_property_attributes ` .
731
+ - ` [in] data ` : User-provided data passed into getter or setter when this is invoked.
732
+
733
+ Returns ` Napi::PropertyDescriptor ` object that represents an instance accessor
734
+ property of a JavaScript class.
735
+
736
+ ### InstanceAccessor
737
+
738
+ Creates property descriptor that represents an instance accessor property of a
739
+ JavaScript class.
740
+
741
+ ``` cpp
742
+ template <InstanceGetterCallback getter, InstanceSetterCallback setter=nullptr >
743
+ static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceAccessor (Symbol name,
744
+ napi_property_attributes attributes = napi_default,
745
+ void* data = nullptr);
746
+ ```
747
+
748
+ - `[in] getter`: The native function to call when a get access to the property of
749
+ a JavaScript class is performed.
750
+ - `[in] setter`: The native function to call when a set access to the property of
751
+ a JavaScript class is performed.
752
+ - `[in] name`: The `Napi::Symbol` object whose value is used to identify the
753
+ instance accessor.
754
+ - `[in] attributes`: The attributes associated with the particular property.
755
+ One or more of `napi_property_attributes`.
756
+ - `[in] data`: User-provided data passed into getter or setter when this is invoked.
757
+
758
+ Returns `Napi::PropertyDescriptor` object that represents an instance accessor
759
+ property of a JavaScript class.
760
+
485
761
### StaticValue
486
762
487
763
Creates property descriptor that represents an static value property of a
0 commit comments