Skip to content

Instantly share code, notes, and snippets.

@Kureev
Last active October 19, 2016 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kureev/dd02b01ebb14897753b717b45a48b059 to your computer and use it in GitHub Desktop.
Save Kureev/dd02b01ebb14897753b717b45a48b059 to your computer and use it in GitHub Desktop.
JsValueRef render(JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState) {
NSString *type = [NSString stringWithUTF8String:ChakraUtils::toString(arguments[1])];
float w {ChakraUtils::toFloat(arguments[2])};
float h {ChakraUtils::toFloat(arguments[3])};
dispatch_async(dispatch_get_main_queue(), ^{
id delegate = [[NSApplication sharedApplication] delegate];
[delegate renderElementOfType:type size:NSMakeSize((CGFloat)w, (CGFloat)h)];
});
return JS_INVALID_REFERENCE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment