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
def printArgsByKind(a, b, c, default=None, intype=int, *more, operation, print_result=False, return_type, ignore_exceptions=True, **kwargs): | |
print("Regular Positional Arguments a: {}, b: {}, c: {}".format(a, b, c)) | |
print("Default Arguments default: {}, intype: {}".format(default, intype) ) | |
print("Variable length positional arguments(tuple) more: {}".format(more)) | |
print("Non-Default Keyword-Only Arguments operation: {}, return_type: {}".format(operation, return_type)) | |
print("Default Keyword-Only Arguments print_result: {}, ignore_exception: {}".format(print_result, ignore_exceptions)) | |
print("Variable length keyword arguments kwargs: {}".format(kwargs)) | |
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
function readFromClipboard() { | |
return navigator.clipboard.readText().then( | |
result => { | |
console.log("Successfully retrieved text from clipboard", result) | |
return Promise.resolve(result); | |
} | |
) | |
.catch( | |
err => { | |
console.log("Error! read text from clipbaord", err) |
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
function writeToClipboardOnPermission(text){ | |
navigator.permissions.query({name:'clipboard-write'}) | |
.then( | |
result => { | |
if (result.state == 'granted' || result.state == 'prompt'){ | |
writeToClipboard(text); | |
} | |
else { | |
console.log("Don't have permissions to use clipboard", result.state); | |
} |
NewerOlder