Example #1
0
dmz::V8Value
dmz::JsExtV8Archive::_archive_release (const v8::Arguments &Args) {

   v8::HandleScope scope;

   V8Value result = v8::Undefined ();

   JsExtV8Archive *self = _to_self (Args);

   if (self && self->_core) {

      const Handle Instance = self->_core->get_instance_handle (Args[0]);

      if (Args.Length () > 1) {

         V8Value value = Args[1];

         if (value->IsFunction ()) {

            V8Function func = v8_to_function (value);

            InstanceStruct *is = self->_instanceTable.lookup (Instance);

            if (is) {

               CallbackStruct *current = is->list;

               while (current) {

                  if (current->func == func) {

                     delete current; current = 0;
                  }
                  else { current = current->next; }
               }
            }
         }
         else {

            if (value->IsString ()) {

            }
         }
      }
      else {

         InstanceStruct *is = self->_instanceTable.remove (Instance);

         if (is) { delete is; is = 0; }
      }
   }

   return scope.Close (result);
}
Example #2
0
dmz::Handle
dmz::JsExtV8Archive::_to_handle (V8Value value) {

   Handle result (_defaultArchive);

   if (value.IsEmpty () == false) {

      if (value->IsNumber ()) { result = v8_to_handle (value); }
      else if (value->IsString ()) {

         result = _defs.create_named_handle (v8_to_string (value));
      }
   }

   return result;
}
Example #3
0
dmz::Handle
dmz::JsExtV8Input::_to_handle (V8Value value) {

   v8::HandleScope scope;

   Handle result (0);

   if (value.IsEmpty () == false) {

      if (value->IsString ()) {

         result = _defs.create_named_handle (*(v8::String::AsciiValue (value)));
      }
      else if (value->IsNumber ()) {

         result = value->Uint32Value ();
      }
   }

   return result;
}