open-index/open-npm huggingface dataset:
npm package: @opentiny/next-ng
Description: app.ts
Latest version: 0.0.1

# @opentiny/next-ng

## 快速开始

app.ts

```typescript
import { AfterViewInit, Component, OnInit } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { NextClientService } from '@opentiny/next-ng';

@Component({
  selector: 'app-root',
  imports: [RouterOutlet],
  templateUrl: './app.html',
  styleUrl: './app.scss'
})
export class App implements OnInit, AfterViewInit {
  protected title = 'ng-demo-next';

  constructor(
    private nextClientService: NextClientService,
  ) {}

  async ngOnInit() {
    const { sessionId } = await this.nextClientService.useNextClient({
      clientInfo: { name: 'my-project', version: '1.0.0' },
      proxyOptions: { url: 'https://xxx/sse', token: '' }
    })
    console.log('sessionId', sessionId)
  }

  ngAfterViewInit() {
    this.nextClientService.connect()
  }
}

```

my-page.ts

```typescript
import { AfterViewInit, Component, OnInit } from '@angular/core';
import { NextServerService } from '@opentiny/next-ng';

@Component({
  selector: 'my-page',
  templateUrl: './my-page.html'
})
export class MyPage implements OnInit, AfterViewInit {
  constructor(private nextServerService: NextServerService) {}

  ngOnInit() {
    const { server } = this.nextServerService.useNextServer({
      serverInfo: { name: 'company-list', version: '1.0.0' }
    })
  }

  ngAfterViewInit() {
    this.nextServerService.connect()
  }
}
```