| 424 | } |
| 425 | |
| 426 | static void First(Nan::NAN_METHOD_ARGS_TYPE info) { |
| 427 | HandleScope scope; |
| 428 | |
| 429 | if (!NodeRT::Utils::IsWinRtWrapperOf< |
| 430 | ::Windows::Foundation::Collections::IIterable<T> ^>(info.This())) { |
| 431 | return; |
| 432 | } |
| 433 | |
| 434 | IterableWrapper<T>* wrapper = |
| 435 | IterableWrapper<T>::Unwrap<IterableWrapper<T>>(info.This()); |
| 436 | |
| 437 | if (info.Length() == 0) { |
| 438 | try { |
| 439 | ::Windows::Foundation::Collections::IIterator<T> ^ result = |
| 440 | wrapper->_instance->First(); |
| 441 | |
| 442 | info.GetReturnValue().Set(IteratorWrapper<T>::CreateIteratorWrapper( |
| 443 | result, wrapper->_getterFunc)); |
| 444 | } catch (Platform::Exception ^ exception) { |
| 445 | NodeRT::Utils::ThrowWinRtExceptionInJs(exception); |
| 446 | return; |
| 447 | } |
| 448 | } else { |
| 449 | Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString( |
| 450 | L"Bad arguments: no suitable overload found"))); |
| 451 | return; |
| 452 | } |
| 453 | |
| 454 | return; |
| 455 | } |
| 456 | |
| 457 | private: |
| 458 | ::Windows::Foundation::Collections::IIterable<T> ^ _instance; |