File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,10 +31,12 @@ NAN_SETTER({{ cppClassName }}::Set{{ field.cppFunctionName }}) {
3131 NanDisposePersistent (wrapper->{{ field.name }});
3232
3333 wrapper->raw ->{{ field.name }} = *ObjectWrap::Unwrap<{{ field.cppClassName }}>(value->ToObject ())->GetValue ();
34- {%elsif field.isFunction | or field. payloadFor %}
34+ {%elsif field.isFunction %}
3535 if (value->IsFunction ()) {
3636 wrapper->credentials = new NanCallback (value.As <Function>());
3737 }
38+ {%elsif field.payloadFor %}
39+ NanAssignPersistent (wrapper->{{ field.name }}, value);
3840 {%elsif field.cppClassName == ' String' %}
3941 if (wrapper->GetValue ()->{{ field.name }}) {
4042 // free(wrapper->{{ field.name }});
Original file line number Diff line number Diff line change @@ -47,11 +47,18 @@ void {{ cppClassName }}::ConstructFields() {
4747 {%if field.hasConstructor %}
4848 Local<Object> test = {{ field.cppClassName }}::New (&this ->raw ->{{ field.name }})->ToObject ();
4949 NanAssignPersistent (this ->{{ field.name }}, test);
50+
5051 {%elsif field.isFunction %}
52+
5153 // Set the static method call and set the payload for this function to be
5254 // the current instance
5355 this ->raw ->{{ field.name }} = ({{ field.cType }}){{ field.name }}_cppCallback;
5456 this ->raw ->{{ fields|payloadFor field.name }} = (void *)this ;
57+ this ->{{ field.name }} = new NanCallback ();
58+ {%elsif field.payloadFor %}
59+
60+ Local<Value> {{ field.name }} = NanUndefined ();
61+ NanAssignPersistent (this ->{{ field.name }}, {{ field.name }});
5562 {%endif%}
5663 {%endeach%}
5764}
You can’t perform that action at this time.
0 commit comments