From 97d8498d46bbfb7bb16eeb3a69565d2aeda1e5aa Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 11 Oct 2019 11:41:54 -0700 Subject: Add init methods for each op module (#3087) --- cli/ops/random.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cli/ops/random.rs') diff --git a/cli/ops/random.rs b/cli/ops/random.rs index 7470eab40..614188d86 100644 --- a/cli/ops/random.rs +++ b/cli/ops/random.rs @@ -1,11 +1,19 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{JsonOp, Value}; +use crate::ops::json_op; use crate::state::ThreadSafeState; use deno::*; use rand::thread_rng; use rand::Rng; -pub fn op_get_random_values( +pub fn init(i: &mut Isolate, s: &ThreadSafeState) { + i.register_op( + "get_random_values", + s.core_op(json_op(s.stateful_op(op_get_random_values))), + ); +} + +fn op_get_random_values( state: &ThreadSafeState, _args: Value, zero_copy: Option, -- cgit v1.2.3