Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Attach modal to Sketch document
let window = document.sketchObject.window()
let fiber = coscript.createFiber()
let alert = NSAlert.alloc().init()
alert.addButtonWithTitle("OK")
alert.addButtonWithTitle("Cancel")
alert.setMessageText("This is the message text")
alert.setInformativeText("This is some extra informative text")
alert.setAlertStyle(NSAlertStyleWarning)
alert.beginSheetModalForWindow_completionHandler(window,__mocha__.createBlock_function(
'v16@?0q8',
(returnCode) => {
try {
handleReturnCode(returnCode)
} catch (err) {
console.error(err)
}
NSApp.endSheet(alert)
if (fiber) {
fiber.cleanup()
}
})
)
function handleReturnCode(returnCode) {
if (returnCode == NSAlertFirstButtonReturn) {
console.log("Success")
} else {
console.log("nope")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.