Last active
September 26, 2020 15:42
-
-
Save KevinGutowski/39a418a25ff2c51959128faf3db070e5 to your computer and use it in GitHub Desktop.
Trigger a Sheet alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sketch = require('sketch') | |
let document = sketch.getSelectedDocument() | |
let documentWindow = document.sketchObject.windowControllers()[0].window()) | |
let mySheetWindow = NSWindow.alloc().initWithContentRect_styleMask_backing_defer( | |
NSMakeRect(0, 0, 200, 100), | |
(NSWindowStyleMaskTitled | NSWindowStyleMaskDocModalWindow), | |
NSBackingStoreBuffered, | |
true | |
) | |
let progressView = NSProgressIndicator | |
.alloc() | |
.initWithFrame(NSMakeRect(20, 20, 160, 12)) | |
progressView.setControlTint(NSBlueControlTint) | |
progressView.startAnimation(true) | |
mySheetWindow.contentView().addSubview(progressView) | |
documentWindow.beginSheet_completionHandler(mySheetWindow, nil) | |
setTimeout(function() { | |
documentWindow.endSheet(mySheetWindow) | |
}, 1000 * 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment