29 lines
804 B
Markdown
Raw Normal View History

2018-10-26 15:44:50 -04:00
# @vue/runtime-core
2018-09-19 11:35:38 -04:00
> This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
2018-09-20 00:17:20 -04:00
2019-09-06 12:58:31 -04:00
For full exposed APIs, see `src/index.ts`. You can also run `yarn build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
## Building a Custom Renderer
2018-09-20 00:17:20 -04:00
``` ts
2019-09-06 12:58:31 -04:00
import { createRenderer, createAppAPI } from '@vue/runtime-core'
2018-09-20 00:17:20 -04:00
2019-09-06 16:58:32 -04:00
const { render, createApp } = createRenderer({
2019-10-21 17:04:34 +03:00
patchProp,
2019-09-06 12:58:31 -04:00
insert,
remove,
createElement,
// ...
2018-09-20 00:17:20 -04:00
})
2019-09-06 16:58:32 -04:00
// `render` is the low-level API
// `createApp` returns an app instance with configurable context shared
// by the entire app tree.
export { render, createApp }
2019-09-06 12:58:31 -04:00
export * from '@vue/runtime-core'
2018-09-20 00:17:20 -04:00
```
2019-09-06 12:58:31 -04:00
See `@vue/runtime-dom` for how a DOM-targeting renderer is implemented.