pub fn mount(isolate: &mut Isolate, id: RustString, peripheral: Box<dyn Peripheral>) {
        let store_cell = Self::get(isolate);
        let mut store = store_cell.borrow_mut();

        let js_api: Global<ObjectTemplate> = {
            let scope = &mut HandleScope::new(isolate);
            let js_api = peripheral.js_api(scope);
            Global::new(scope, js_api)
        };

        store.peripherals.insert(id, PeripheralEntry {
            type_name: peripheral.type_name(),
            js_api,
        });
    }
/// Mounts a peripheral into a V8 isolate.
Mounts a peripheral into a V8 isolate.
Mounts a peripheral into a V8 isolate .
pub fn mount(isolate: &mut Isolate, id: RustString, peripheral: Box<dyn Peripheral>) {
        let store_cell = Self::get(isolate);
        let mut store = store_cell.borrow_mut();
        let js_api: Global<ObjectTemplate> = {
            let scope = &mut HandleScope::new(isolate);
            let js_api = peripheral.js_api(scope);
            Global::new(scope, js_api)
        };
        store.peripherals.insert(id, PeripheralEntry {
            type_name: peripheral.type_name(),
            js_api,
        });
    }
pub fn mount ( isolate : & mut Isolate , id : RustString , peripheral : Box < dyn Peripheral > ) { let store_cell = Self :: get ( isolate ) ; let mut store = store_cell . borrow_mut ( ) ; let js_api : Global < ObjectTemplate > = { let scope = & mut HandleScope :: new ( isolate ) ; let js_api = peripheral . js_api ( scope ) ; Global :: new ( scope , js_api ) } ; store . peripherals . insert ( id , PeripheralEntry { type_name : peripheral . type_name ( ) , js_api , } ) ; }
Mounts a peripheral into a V8 isolate.
Mounts a peripheral into a V8 isolate .
isolate
&mut Isolate
id
RustString
peripheral
Box<dyn Peripheral>
isolate
&mut Isolate
id
RustString
peripheral
Box<dyn Peripheral>