Skip to content

Instantly share code, notes, and snippets.

@KevinGutowski
Last active September 26, 2020 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save KevinGutowski/39a418a25ff2c51959128faf3db070e5 to your computer and use it in GitHub Desktop.
Save KevinGutowski/39a418a25ff2c51959128faf3db070e5 to your computer and use it in GitHub Desktop.
Trigger a Sheet alert
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