Closed Ksengine closed 3 years ago
Good suggestion.
I disagree with overloading the window object, but these could be placed into pywebview.window
. The api and method names could be same or at least similar to the methods of the window.py
.
Comments? Other ideas?
we can set pywebview.window methods to window
eg:
window.moveTo=pywebview.window.moveTo;
can u set suitable labels to this issue
can we add this methods to jsbridge class. please, explain it
can i make a pull
Overwriting Javascript built-in functions is a bad practice. I would rather have these separately, for example under pywebview.window
. The API could be
pywebview.window.createFileDialog(params)
pywebview.window.destroy()
pywebview.window.hide()
pywebview.window.minimize()
pywebview.window.move(x, y)
pywebview.window.resize(width, height)
pywebview.window.restore()
pywebview.window.show()
pywebview.window.toggleFullscreen()
I am not sure what to with properties.
Overwriting Javascript built-in functions is a bad practice why?
We can use ECMAScript5 (for properties)
Browser Support
Chrome 23 | IE10 / Edge | Firefox 21 | Safari 6 | Opera 15 |
Sep 2012 | Sep 2012 | Apr 2013 | Jul 2012 | Jul 2013 |
example
// Define object
var obj = {counter : 0};
// Define setters
Object.defineProperty(obj, "reset", {
get : function () {this.counter = 0;}
});
Object.defineProperty(obj, "increment", {
get : function () {this.counter++;}
});
Object.defineProperty(obj, "decrement", {
get : function () {this.counter--;}
});
Object.defineProperty(obj, "add", {
set : function (value) {this.counter += value;}
});
Object.defineProperty(obj, "subtract", {
set : function (value) {this.counter -= value;}
});
// Play with the counter:
obj.reset;
obj.add = 5;
obj.subtract = 1;
obj.increment;
obj.decrement;
if not supported;(older than IE10)
window.__defineGetter__('innerWidth', function() { return pywebview.window.getInnerWidth(); });
window.__defineSetter__('innerWidth', function(val) { pywebview.window.setInnerWidth(val); });
window.innerWidth = 5;
console.log(window.innerWidth);
can i make a pull
Its good
can i make a pull
Please go ahead.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The message to post on the issue when closing it. If none provided, will not comment when closing an issue.
Description
add this methods to use from javascript(from webpage side) this methods are not supported in most browsers
Practicalities