我是v8的新手,正在使用6.9.0.0(最新)。
执行以下操作后:
v8::Local<v8::Value> parsed = v8::JSON::Parse(context,buffer1).ToLocalChecked();
如何访问解析对(如JS中的parsed.parameter1)?简单的寻址似乎行不通。
答案 0 :(得分:0)
查看V8的API的各种功能:
例如,const appRoutes: Routes = [
{ path: 'login', component: LoginComponent},
{ path: 'new-vendor-registration', component: NewVendorComponent},
{ path: 'new-vendor-card-add', component: NewVendorCardComponent },
{ path: 'forgot-password', component: ForgotPasswordComponent},
{
path: '',
redirectTo: 'dashboard',
pathMatch: 'full',
},
{ path: '', component: DashboardLayoutComponent, data: { title: '' }, children: DASHBOARD_ROUTES },
{ path: '', component: DashboardLayoutComponent, data: { title: '' }, children: USER_ROUTES, canActivate: [AuthGuard] },
{ path: '', component: DashboardLayoutComponent, data: { title: '' }, children: OFFER_ROUTES, canActivate: [AuthGuard] },
{ path: '', component: DashboardLayoutComponent, data: { title: '' }, children: PROMOTION_ROUTES, canActivate: [AuthGuard] }
// { path: '', component: TwoColumnsLayoutComponent, data: { title: '' }, children: TWO_COLUMN_ROUTES, canActivate: [AuthGuard] },
];
@NgModule({
imports: [RouterModule.forRoot(appRoutes)],
exports: [RouterModule]
})
有@NgModule({
declarations: [
AppComponent,
TwoColumnsLayoutComponent,
DashboardLayoutComponent,
LoginComponent,
NewVendorComponent,
NewVendorCardComponent,
ForgotPasswordComponent
],
imports: [
BrowserAnimationsModule,
NgxDatatableModule,
HttpClientModule,
FormsModule,
AppRoutingModule,
SharedModule,
NgbModule.forRoot(),
AngularFireModule.initializeApp(firebaseConfig),
AngularFireDatabaseModule,
AngularFireAuthModule,
MyDatePickerModule,
TextMaskModule
],
providers: [
{provide: LocationStrategy, useClass: HashLocationStrategy},
AuthService,
AuthGuard,
VendorService,
SalesrepService,
PaymentService,
SubscriptionService,
OfferService,
PromotionService,
WeatherService,
Broadcaster
],
bootstrap: [AppComponent]
})
export class AppModule {}
,当返回v8::Local
时,您可以创建一个IsObject()
,而true
具有例如v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(parsed);
和v8::Object
等。
简而言之,V8的API提供了JavaScript对象模型的C ++实现。使用它有点笨拙,这是因为JS对象模型与C ++的模型非常不同。