|
@@ -2,3 +2,22 @@
|
2
|
2
|
%include "stdint.i"
|
3
|
3
|
|
4
|
4
|
%typemap(out) mraa_result_t = int;
|
|
5
|
+
|
|
6
|
+#if (SWIG_JAVASCRIPT_V8)
|
|
7
|
+%{
|
|
8
|
+ // Because there's no guarantee that v8 will ever call garbage collection,
|
|
9
|
+ // we're adding a function that will allow a user to call it manually
|
|
10
|
+ void cleanUp()
|
|
11
|
+ {
|
|
12
|
+ // Call the v8 garbage collector as long as there is memory to clean up
|
|
13
|
+ // See https://codereview.chromium.org/412163003 for this API change
|
|
14
|
+#if (SWIG_V8_VERSION < 0x032838)
|
|
15
|
+ while (!v8::V8::IdleNotification())
|
|
16
|
+#else
|
|
17
|
+ while (!v8::Isolate::GetCurrent()->IdleNotification(1000))
|
|
18
|
+#endif
|
|
19
|
+ {;}
|
|
20
|
+ }
|
|
21
|
+%}
|
|
22
|
+void cleanUp();
|
|
23
|
+#endif
|