File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,13 @@ extern {
279
279
#[ wasm_bindgen( static_method_of = Math ) ]
280
280
pub fn atan ( number : i32 ) -> Number ;
281
281
282
+ /// The Math.atan2() function returns the arctangent of the quotient of
283
+ /// its arguments.
284
+ ///
285
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2
286
+ #[ wasm_bindgen( static_method_of = Math ) ]
287
+ pub fn atan2 ( y : i32 , x : i32 ) -> Number ;
288
+
282
289
}
283
290
284
291
// Number.
Original file line number Diff line number Diff line change @@ -160,3 +160,29 @@ fn atan() {
160
160
"# )
161
161
. test ( )
162
162
}
163
+
164
+ #[ test]
165
+ fn atan2 ( ) {
166
+ project ( )
167
+ . file ( "src/lib.rs" , r#"
168
+ #![feature(proc_macro, wasm_custom_section)]
169
+
170
+ extern crate wasm_bindgen;
171
+ use wasm_bindgen::prelude::*;
172
+ use wasm_bindgen::js;
173
+
174
+ #[wasm_bindgen]
175
+ pub fn atan2(x: i32, y: i32) -> js::Number {
176
+ js::Math::atan2(x, y)
177
+ }
178
+ "# )
179
+ . file ( "test.ts" , r#"
180
+ import * as assert from "assert";
181
+ import * as wasm from "./out";
182
+
183
+ export function test() {
184
+ assert.equal(wasm.atan2(1, 2), Math.atan2(1, 2));
185
+ }
186
+ "# )
187
+ . test ( )
188
+ }
You can’t perform that action at this time.
0 commit comments