-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
36 lines (31 loc) · 1.36 KB
/
test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Prism {
getInfo() {
return {
id: 'helloworld',
name: 'It works!',
blocks: [
{
opcode: 'hello',
blockType: Scratch.BlockType.REPORTER,
text: 'Hello!'
}
]
};
}
hello() {
// should we look for an external canvas
if (this.runtime.prism_screenshot_checkForExternalCanvas) {
// if so, does one exist (this will check for more than 1 in the future)
if (this.runtime.prism_screenshot_externalCanvas) {
// we dont need to check camera permissions since external canvases
// will never have the ability to get camera data
return this.runtime.prism_screenshot_externalCanvas.toDataURL();
}
}
// DO NOT REMOVE, USER HAS NOT GIVEN PERMISSION TO SAVE CAMERA IMAGES.
if (this.runtime.ext_videoSensing || this.runtime.ioDevices.video.provider.enabled) {
// user's camera is on, ask for permission to take a picture of them
if (!(this.isCameraScreenshotEnabled)) {
this.isCameraScreenshotEnabled = ProjectPermissionManager.RequestPermission("cameraPictures");
if (!this.isCameraScreenshotEnabled) return "data:image/png;base64,
Scratch.extensions.register(new HelloWorld());