@@ -84,11 +84,15 @@ class ChaChaPolyCipher : public ObjectWrap {
84
84
SetPrototypeMethod (tpl, " encrypt" , Encrypt);
85
85
SetPrototypeMethod (tpl, " free" , Free);
86
86
87
- constructor ().Reset (Nan::GetFunction (tpl).ToLocalChecked ());
87
+ Local<Function> func = Nan::GetFunction (tpl).ToLocalChecked ();
88
+ Local<Context> context = Nan::GetCurrentContext ();
89
+ v8::Isolate* isolate = context->GetIsolate ();
90
+
91
+ constructor ().Set (isolate, func);
88
92
89
93
Nan::Set (target,
90
94
Nan::New (" ChaChaPolyCipher" ).ToLocalChecked (),
91
- Nan::GetFunction (tpl). ToLocalChecked () );
95
+ func );
92
96
}
93
97
94
98
private:
@@ -387,8 +391,8 @@ class ChaChaPolyCipher : public ObjectWrap {
387
391
obj->clear ();
388
392
}
389
393
390
- static inline Nan::Persistent< Function> & constructor () {
391
- static Nan::Persistent< Function> my_constructor;
394
+ static inline v8::Eternal<v8:: Function> & constructor () {
395
+ static v8::Eternal<v8:: Function> my_constructor;
392
396
return my_constructor;
393
397
}
394
398
@@ -414,11 +418,15 @@ class AESGCMCipher : public ObjectWrap {
414
418
SetPrototypeMethod (tpl, " encrypt" , Encrypt);
415
419
SetPrototypeMethod (tpl, " free" , Free);
416
420
417
- constructor ().Reset (Nan::GetFunction (tpl).ToLocalChecked ());
421
+ Local<Function> func = Nan::GetFunction (tpl).ToLocalChecked ();
422
+ Local<Context> context = Nan::GetCurrentContext ();
423
+ v8::Isolate* isolate = context->GetIsolate ();
424
+
425
+ constructor ().Set (isolate, func);
418
426
419
427
Nan::Set (target,
420
428
Nan::New (" AESGCMCipher" ).ToLocalChecked (),
421
- Nan::GetFunction (tpl). ToLocalChecked () );
429
+ func );
422
430
}
423
431
424
432
private:
@@ -633,8 +641,8 @@ class AESGCMCipher : public ObjectWrap {
633
641
obj->clear ();
634
642
}
635
643
636
- static inline Nan::Persistent< Function> & constructor () {
637
- static Nan::Persistent< Function> my_constructor;
644
+ static inline v8::Eternal<v8:: Function> & constructor () {
645
+ static v8::Eternal<v8:: Function> my_constructor;
638
646
return my_constructor;
639
647
}
640
648
@@ -651,11 +659,15 @@ class GenericCipher : public ObjectWrap {
651
659
SetPrototypeMethod (tpl, " encrypt" , Encrypt);
652
660
SetPrototypeMethod (tpl, " free" , Free);
653
661
654
- constructor ().Reset (Nan::GetFunction (tpl).ToLocalChecked ());
662
+ Local<Function> func = Nan::GetFunction (tpl).ToLocalChecked ();
663
+ Local<Context> context = Nan::GetCurrentContext ();
664
+ v8::Isolate* isolate = context->GetIsolate ();
665
+
666
+ constructor ().Set (isolate, func);
655
667
656
668
Nan::Set (target,
657
669
Nan::New (" GenericCipher" ).ToLocalChecked (),
658
- Nan::GetFunction (tpl). ToLocalChecked () );
670
+ func );
659
671
}
660
672
661
673
private:
@@ -1014,8 +1026,8 @@ class GenericCipher : public ObjectWrap {
1014
1026
obj->clear ();
1015
1027
}
1016
1028
1017
- static inline Nan::Persistent< Function> & constructor () {
1018
- static Nan::Persistent< Function> my_constructor;
1029
+ static inline v8::Eternal<v8:: Function> & constructor () {
1030
+ static v8::Eternal<v8:: Function> my_constructor;
1019
1031
return my_constructor;
1020
1032
}
1021
1033
@@ -1044,11 +1056,15 @@ class ChaChaPolyDecipher : public ObjectWrap {
1044
1056
SetPrototypeMethod (tpl, " decryptLen" , DecryptLen);
1045
1057
SetPrototypeMethod (tpl, " free" , Free);
1046
1058
1047
- constructor ().Reset (Nan::GetFunction (tpl).ToLocalChecked ());
1059
+ Local<Function> func = Nan::GetFunction (tpl).ToLocalChecked ();
1060
+ Local<Context> context = Nan::GetCurrentContext ();
1061
+ v8::Isolate* isolate = context->GetIsolate ();
1062
+
1063
+ constructor ().Set (isolate, func);
1048
1064
1049
1065
Nan::Set (target,
1050
1066
Nan::New (" ChaChaPolyDecipher" ).ToLocalChecked (),
1051
- Nan::GetFunction (tpl). ToLocalChecked () );
1067
+ func );
1052
1068
}
1053
1069
1054
1070
private:
@@ -1440,8 +1456,8 @@ class ChaChaPolyDecipher : public ObjectWrap {
1440
1456
obj->clear ();
1441
1457
}
1442
1458
1443
- static inline Nan::Persistent< Function> & constructor () {
1444
- static Nan::Persistent< Function> my_constructor;
1459
+ static inline v8::Eternal<v8:: Function> & constructor () {
1460
+ static v8::Eternal<v8:: Function> my_constructor;
1445
1461
return my_constructor;
1446
1462
}
1447
1463
@@ -1468,11 +1484,15 @@ class AESGCMDecipher : public ObjectWrap {
1468
1484
SetPrototypeMethod (tpl, " decrypt" , Decrypt);
1469
1485
SetPrototypeMethod (tpl, " free" , Free);
1470
1486
1471
- constructor ().Reset (Nan::GetFunction (tpl).ToLocalChecked ());
1487
+ Local<Function> func = Nan::GetFunction (tpl).ToLocalChecked ();
1488
+ Local<Context> context = Nan::GetCurrentContext ();
1489
+ v8::Isolate* isolate = context->GetIsolate ();
1490
+
1491
+ constructor ().Set (isolate, func);
1472
1492
1473
1493
Nan::Set (target,
1474
1494
Nan::New (" AESGCMDecipher" ).ToLocalChecked (),
1475
- Nan::GetFunction (tpl). ToLocalChecked () );
1495
+ func );
1476
1496
}
1477
1497
1478
1498
private:
@@ -1697,8 +1717,8 @@ class AESGCMDecipher : public ObjectWrap {
1697
1717
obj->clear ();
1698
1718
}
1699
1719
1700
- static inline Nan::Persistent< Function> & constructor () {
1701
- static Nan::Persistent< Function> my_constructor;
1720
+ static inline v8::Eternal<v8:: Function> & constructor () {
1721
+ static v8::Eternal<v8:: Function> my_constructor;
1702
1722
return my_constructor;
1703
1723
}
1704
1724
@@ -1716,11 +1736,15 @@ class GenericDecipher : public ObjectWrap {
1716
1736
SetPrototypeMethod (tpl, " decrypt" , Decrypt);
1717
1737
SetPrototypeMethod (tpl, " free" , Free);
1718
1738
1719
- constructor ().Reset (Nan::GetFunction (tpl).ToLocalChecked ());
1739
+ Local<Function> func = Nan::GetFunction (tpl).ToLocalChecked ();
1740
+ Local<Context> context = Nan::GetCurrentContext ();
1741
+ v8::Isolate* isolate = context->GetIsolate ();
1742
+
1743
+ constructor ().Set (isolate, func);
1720
1744
1721
1745
Nan::Set (target,
1722
1746
Nan::New (" GenericDecipher" ).ToLocalChecked (),
1723
- Nan::GetFunction (tpl). ToLocalChecked () );
1747
+ func );
1724
1748
}
1725
1749
1726
1750
private:
@@ -2183,8 +2207,8 @@ class GenericDecipher : public ObjectWrap {
2183
2207
obj->clear ();
2184
2208
}
2185
2209
2186
- static inline Nan::Persistent< Function> & constructor () {
2187
- static Nan::Persistent< Function> my_constructor;
2210
+ static inline v8::Eternal<v8:: Function> & constructor () {
2211
+ static v8::Eternal<v8:: Function> my_constructor;
2188
2212
return my_constructor;
2189
2213
}
2190
2214
0 commit comments