@@ -591,47 +591,27 @@ bool zjs_ble_parse_characteristic(jerry_object_t *chrc_obj,
591591
592592 jerry_value_t v_func ;
593593 v_func = jerry_get_object_field_value (chrc_obj , "onReadRequest" );
594- if (!jerry_value_is_error (v_func )) {
595- if (!jerry_value_is_function (v_func )) {
596- PRINT ("onReadRequest callback is not a function\n" );
597- return false;
598- }
594+ if (jerry_value_is_function (v_func )) {
599595 chrc -> read_cb .zjs_cb .js_callback = jerry_acquire_object (jerry_get_object_value (v_func ));
600596 }
601597
602598 v_func = jerry_get_object_field_value (chrc_obj , "onWriteRequest" );
603- if (!jerry_value_is_error (v_func )) {
604- if (!jerry_value_is_function (v_func )) {
605- PRINT ("onWriteRequest callback is not a function\n" );
606- return false;
607- }
599+ if (jerry_value_is_function (v_func )) {
608600 chrc -> write_cb .zjs_cb .js_callback = jerry_acquire_object (jerry_get_object_value (v_func ));
609601 }
610602
611603 v_func = jerry_get_object_field_value (chrc_obj , "onSubscribe" );
612- if (!jerry_value_is_error (v_func )) {
613- if (!jerry_value_is_function (v_func )) {
614- PRINT ("onSubscribe callback is not a function\n" );
615- return false;
616- }
604+ if (jerry_value_is_function (v_func )) {
617605 chrc -> subscribe_cb .zjs_cb .js_callback = jerry_acquire_object (jerry_get_object_value (v_func ));
618606 }
619607
620608 v_func = jerry_get_object_field_value (chrc_obj , "onUnsubscribe" );
621- if (!jerry_value_is_error (v_func )) {
622- if (!jerry_value_is_function (v_func )) {
623- PRINT ("onUnsubscribe callback is not a function\n" );
624- return false;
625- }
609+ if (jerry_value_is_function (v_func )) {
626610 chrc -> unsubscribe_cb .zjs_cb .js_callback = jerry_acquire_object (jerry_get_object_value (v_func ));
627611 }
628612
629613 v_func = jerry_get_object_field_value (chrc_obj , "onNotify" );
630- if (!jerry_value_is_error (v_func )) {
631- if (!jerry_value_is_function (v_func )) {
632- PRINT ("onNotify callback is not a function\n" );
633- return false;
634- }
614+ if (jerry_value_is_function (v_func )) {
635615 chrc -> notify_cb .zjs_cb .js_callback = jerry_acquire_object (jerry_get_object_value (v_func ));
636616 }
637617
0 commit comments