diff --git a/src/use_web_notification.rs b/src/use_web_notification.rs index fd730d6..23f5f83 100644 --- a/src/use_web_notification.rs +++ b/src/use_web_notification.rs @@ -281,7 +281,8 @@ pub struct UseWebNotificationOptions { #[builder(into)] silent: Option, - /// A `Vec` value specifying the vibration pattern in which the device is vibrating and not vibrating. + /// A `Vec` specifying the vibration pattern in milliseconds for vibrating and not vibrating. + /// The last entry can be a vibration since it stops automatically after each period. #[builder(into)] vibrate: Option>, @@ -416,7 +417,8 @@ pub struct ShowOptions { #[builder(into)] silent: Option, - /// A `Vec` value specifying the vibration pattern in which the device is vibrating and not vibrating. + /// A `Vec` specifying the vibration pattern in milliseconds for vibrating and not vibrating. + /// The last entry can be a vibration since it stops automatically after each period. #[builder(into)] vibrate: Option>, } @@ -477,8 +479,8 @@ fn browser_supports_notifications() -> bool { false } -/// Helper function to convert `Vec` into a `JsValue` array that represents a vibration pattern -fn vibration_pattern_to_jsvalue(pattern: &Vec) -> JsValue { +/// Helper function to convert a slice of `u16` into a `JsValue` array that represents a vibration pattern +fn vibration_pattern_to_jsvalue(pattern: &[u16]) -> JsValue { let array = js_sys::Array::new(); for &value in pattern.iter() { array.push(&JsValue::from(value));