svelte-dev-helper
Advanced tools
Comparing version 0.5.0 to 1.0.0
{ | ||
"name": "svelte-dev-helper", | ||
"version": "0.5.0", | ||
"version": "1.0.0", | ||
"description": "Helper for svelte components to ease development", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# svelte-dev-helper | ||
Helper for svelte components to ease development | ||
Helper for svelte components to ease development. | ||
Used under the hood by [svelte-hot-loader](https://github.com/ekhaled/svelte-hot-loader) | ||
##Usage | ||
This is meant to be used under the hood for creating a build toolchain, or a dev helper based on [Svelte](https://svelte.technology/) components; | ||
This is meant to be used under the hood for creating a build toolchain, or a dev helper based on [Svelte](https://svelte.technology/) components. | ||
@@ -17,2 +18,3 @@ ```js | ||
Registry.set(id, { | ||
rollback: null, | ||
component: Component, | ||
@@ -26,4 +28,11 @@ instances:[] | ||
The component returned by `createProxy` now does the following | ||
1. Add a `<!--<Component>-->` comment marker in the DOM just above where the component's DOM starts | ||
The component returned by `createProxy` now has the following features: | ||
1. Adds a `<!--<Component>-->` comment marker in the DOM just above where the component's DOM starts | ||
2. You can access the component instance using `$0.__component__` in devtools after higlighting the comment marker from above. | ||
3. You can access all **rendered** instances of a particular component using `Registry.get(id).instances` | ||
4. All instances have a `_rerender` method | ||
4. If you switch the `component` in the registry (using `Registry.set(id, Registry.get(id).component = newComponent)`) all **future renders** of the component will use the newly switched component. | ||
5. Following a switch as per above, you can switch all **rendered** components by first accessing the instances and then calling `_rerender` on them. | ||
6. The `rollback` property in any `Registry` item can be used to hold the last good version of a component. If there is an error instantiating a switched component, it will try to use the component version stored in `rollback` | ||
The `Registry` is also available at `window.__SVELTE_REGISTRY__` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9971
1
37