#[repr(transparent)]pub struct Options { /* private fields */ }Expand description
Window open options
Implementations§
source§impl Options
impl Options
sourcepub fn id(self, id: &str) -> Self
pub fn id(self, id: &str) -> Self
the id used to identify the window. This will be used to remember the size and position of the window and restore that geometry when a window with the same id is later opened. See also the Chrome App documentation ⧉ NWJS Documentation
sourcepub fn title(self, title: &str) -> Self
pub fn title(self, title: &str) -> Self
The default title of window created by NW.js, . it’s very useful if you want to show your own title when the app is starting
sourcepub fn position(self, position: WindowPosition) -> Self
pub fn position(self, position: WindowPosition) -> Self
Move window to specified position. Currently only center is supported on all platforms, which will put window in the middle of the screen.
There are three valid positions: null or center or mouse
sourcepub fn min_height(self, min_height: u32) -> Self
pub fn min_height(self, min_height: u32) -> Self
minimum inner height of window
sourcepub fn max_height(self, max_height: u32) -> Self
pub fn max_height(self, max_height: u32) -> Self
maximum inner height of window
sourcepub fn as_desktop(self, as_desktop: bool) -> Self
pub fn as_desktop(self, as_desktop: bool) -> Self
(Linux) show as desktop background window under X11 environment
sourcepub fn always_on_top(self, always_on_top: bool) -> Self
pub fn always_on_top(self, always_on_top: bool) -> Self
whether the window should always stay on top of other windows.
sourcepub fn visible_on_all_workspaces(self, visible_on_all_workspaces: bool) -> Self
pub fn visible_on_all_workspaces(self, visible_on_all_workspaces: bool) -> Self
whether the window should be visible on all workspaces simultaneously (on platforms that support multiple workspaces, currently Mac OS X and Linux).
sourcepub fn fullscreen(self, fullscreen: bool) -> Self
pub fn fullscreen(self, fullscreen: bool) -> Self
whether window is fullscreen
Beware, if frame is also set to false in fullscreen it will prevent the mouse from being captured on the very edges of the screen. You should avoid activate it if fullscreen is also set to true.
sourcepub fn show_in_taskbar(self, show_in_taskbar: bool) -> Self
pub fn show_in_taskbar(self, show_in_taskbar: bool) -> Self
whether the window is shown in taskbar or dock. The default is true.
sourcepub fn frame(self, frame: bool) -> Self
pub fn frame(self, frame: bool) -> Self
specify it to false to make the window frameless
Beware, if frame is set to false in fullscreen it will prevent the mouse from being captured on the very edges of the screen. You should avoid activating it if fullscreen is also set to true.
Frameless apps do not have a title bar for the user to click and drag the window. You can use CSS to designate DOM elements as draggable regions.
.drag-enable {
-webkit-app-region: drag;
}
.drag-disable {
-webkit-app-region: no-drag;
}
sourcepub fn show(self, show: bool) -> Self
pub fn show(self, show: bool) -> Self
specify it to false if you want your app to be hidden on startup
sourcepub fn kiosk(self, kiosk: bool) -> Self
pub fn kiosk(self, kiosk: bool) -> Self
whether to use Kiosk mode. In Kiosk mode, the app will be fullscreen
and try to prevent users from leaving the app, so you should
remember to provide a way in app to leave Kiosk mode.
This mode is mainly used for presentation on public displays
sourcepub fn transparent(self, transparent: bool) -> Self
pub fn transparent(self, transparent: bool) -> Self
whether to turn on transparent window mode.
The default is false.
Control the transparency with rgba background value in CSS.
Use command line option --disable-transparency to disable this
feature completely.
There is experimental support for “click-through” on the
transparent region: add --disable-gpu option to the command line.
sourcepub fn new_instance(self, value: bool) -> Self
pub fn new_instance(self, value: bool) -> Self
whether to open a new window in a separate render process.
sourcepub fn mixed_context(self, value: bool) -> Self
pub fn mixed_context(self, value: bool) -> Self
If true, the Node context and DOM context are merged in the new window’s process. Use only when new_instance is true.
sourcepub fn inject_js_start(self, js: &str) -> Self
pub fn inject_js_start(self, js: &str) -> Self
the script to be injected before any DOM is constructed and any script is run.
sourcepub fn inject_js_end(self, js: &str) -> Self
pub fn inject_js_end(self, js: &str) -> Self
the script to be injected after the document object is loaded, before onload event is fired.
Methods from Deref<Target = Object>§
sourcepub fn constructor(&self) -> Function
pub fn constructor(&self) -> Function
The constructor property returns a reference to the Object constructor
function that created the instance object.
sourcepub fn has_own_property(&self, property: &JsValue) -> bool
pub fn has_own_property(&self, property: &JsValue) -> bool
The hasOwnProperty() method returns a boolean indicating whether the
object has the specified property as its own property (as opposed to
inheriting it).
sourcepub fn is_prototype_of(&self, value: &JsValue) -> bool
pub fn is_prototype_of(&self, value: &JsValue) -> bool
The isPrototypeOf() method checks if an object exists in another
object’s prototype chain.
sourcepub fn property_is_enumerable(&self, property: &JsValue) -> bool
pub fn property_is_enumerable(&self, property: &JsValue) -> bool
The propertyIsEnumerable() method returns a Boolean indicating
whether the specified property is enumerable.
sourcepub fn to_locale_string(&self) -> JsString
pub fn to_locale_string(&self) -> JsString
The toLocaleString() method returns a string representing the object.
This method is meant to be overridden by derived objects for
locale-specific purposes.
sourcepub fn to_string(&self) -> JsString
pub fn to_string(&self) -> JsString
The toString() method returns a string representing the object.
Methods from Deref<Target = JsValue>§
pub const NULL: JsValue = JsValue::_new(JSIDX_NULL)
pub const UNDEFINED: JsValue = JsValue::_new(JSIDX_UNDEFINED)
pub const TRUE: JsValue = JsValue::_new(JSIDX_TRUE)
pub const FALSE: JsValue = JsValue::_new(JSIDX_FALSE)
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the f64 value of this JS value if it’s an instance of a
number.
If this JS value is not an instance of a number then this returns
None.
sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
If this JS value is a string value, this function copies the JS string
value into wasm linear memory, encoded as UTF-8, and returns it as a
Rust String.
To avoid the copying and re-encoding, consider the
JsString::try_from() function from js-sys
instead.
If this JS value is not an instance of a string or if it’s not valid
utf-8 then this returns None.
UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str type which contains a few
caveats about the encodings.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the bool value of this JS value if it’s an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None.
sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function.
sourcepub fn js_in(&self, obj: &JsValue) -> bool
pub fn js_in(&self, obj: &JsValue) -> bool
Applies the binary in JS operator on the two JsValues.
sourcepub fn loose_eq(&self, other: &JsValue) -> bool
pub fn loose_eq(&self, other: &JsValue) -> bool
Compare two JsValues for equality, using the == operator in JS.
sourcepub fn unsigned_shr(&self, rhs: &JsValue) -> u32
pub fn unsigned_shr(&self, rhs: &JsValue) -> u32
Applies the binary >>> JS operator on the two JsValues.
sourcepub fn checked_div(&self, rhs: &JsValue) -> JsValue
pub fn checked_div(&self, rhs: &JsValue) -> JsValue
Applies the binary / JS operator on two JsValues, catching and returning any RangeError thrown.
sourcepub fn pow(&self, rhs: &JsValue) -> JsValue
pub fn pow(&self, rhs: &JsValue) -> JsValue
Applies the binary ** JS operator on the two JsValues.
sourcepub fn lt(&self, other: &JsValue) -> bool
pub fn lt(&self, other: &JsValue) -> bool
Applies the binary < JS operator on the two JsValues.
sourcepub fn le(&self, other: &JsValue) -> bool
pub fn le(&self, other: &JsValue) -> bool
Applies the binary <= JS operator on the two JsValues.
sourcepub fn ge(&self, other: &JsValue) -> bool
pub fn ge(&self, other: &JsValue) -> bool
Applies the binary >= JS operator on the two JsValues.
sourcepub fn gt(&self, other: &JsValue) -> bool
pub fn gt(&self, other: &JsValue) -> bool
Applies the binary > JS operator on the two JsValues.
sourcepub fn unchecked_into_f64(&self) -> f64
pub fn unchecked_into_f64(&self) -> f64
Applies the unary + JS operator on a JsValue. Can throw.
Trait Implementations§
source§impl FromWasmAbi for Options
impl FromWasmAbi for Options
source§impl<'a> IntoWasmAbi for &'a Options
impl<'a> IntoWasmAbi for &'a Options
source§impl IntoWasmAbi for Options
impl IntoWasmAbi for Options
source§impl JsCast for Options
impl JsCast for Options
source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
instanceof check to see whether the JsValue
provided is an instance of this type. Read moresource§fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js(val: JsValue) -> Self
source§fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere T: JsCast,
T. Read moresource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where T: JsCast,
T. Read moresource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where T: JsCast,
T. Read moresource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere T: JsCast,
source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere T: JsCast,
source§impl LongRefFromWasmAbi for Options
impl LongRefFromWasmAbi for Options
source§impl OptionFromWasmAbi for Options
impl OptionFromWasmAbi for Options
source§impl<'a> OptionIntoWasmAbi for &'a Options
impl<'a> OptionIntoWasmAbi for &'a Options
source§impl OptionIntoWasmAbi for Options
impl OptionIntoWasmAbi for Options
source§impl OptionsTrait for Options
impl OptionsTrait for Options
source§impl PartialEq<Options> for Options
impl PartialEq<Options> for Options
source§impl RefFromWasmAbi for Options
impl RefFromWasmAbi for Options
§type Abi = <JsValue as RefFromWasmAbi>::Abi
type Abi = <JsValue as RefFromWasmAbi>::Abi
Self are recovered from.§type Anchor = ManuallyDrop<Options>
type Anchor = ManuallyDrop<Options>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.impl Eq for Options
impl StructuralEq for Options
impl StructuralPartialEq for Options
Auto Trait Implementations§
impl RefUnwindSafe for Options
impl !Send for Options
impl !Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abisource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.