-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
provide debug utilities for inspector via event communication #20580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this implementation is good for now, but we'll need to change things later, because I think we want ember-source to push panels into the inspector somehow. needs some planning there, but it'd be great if ember-source's part of the inspector could be tested within ember-source, and than the inspector slurps those up (automatic updates depending on ember-source version!)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think pushing panels is not needed. more important would be to push a ember_debug directly from ember.js instead of having inspectors ember_debug try to support multiple versions.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well the thinking here is that because ember.js is has more people working on it, it could be updated more easily than the inspector -- and then the inspector also doesn't need to maintain compatibility with everything going forward -- as it would be provided by ember-source we should probs move to talking about this on the discord though -- lots of details to work through |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| // required for inspector | ||
| import { isTesting } from './lib/testing'; | ||
| import { _backburner, cancel, debounce, join, later, scheduleOnce } from '@ember/runloop'; | ||
| import { cacheFor, guidFor } from '@ember/object/internals'; | ||
| import { default as MutableArray } from '@ember/array/mutable'; | ||
| import { default as Namespace } from '@ember/application/namespace'; | ||
| import { default as MutableEnumerable } from '@ember/enumerable/mutable'; | ||
| import { NativeArray } from '@ember/array'; | ||
| import { ControllerMixin } from '@ember/controller'; | ||
| import { default as CoreObject } from '@ember/object/core'; | ||
| import { default as Application } from '@ember/application'; | ||
| import { default as EmberComponent } from '@ember/component'; | ||
| import { default as Observable } from '@ember/object/observable'; | ||
| import { default as Evented } from '@ember/object/evented'; | ||
| import { default as PromiseProxyMixin } from '@ember/object/promise-proxy-mixin'; | ||
| import { default as EmberObject } from '@ember/object'; | ||
| import { default as VERSION } from 'ember/version'; | ||
| import { | ||
| ComputedProperty, | ||
| isComputed, | ||
| descriptorForProperty, | ||
| descriptorForDecorator, | ||
| tagForProperty, | ||
| libraries, | ||
| } from '@ember/-internals/metal'; | ||
| import { isMandatorySetter } from '@ember/-internals/utils'; | ||
| import { meta } from '@ember/-internals/meta'; | ||
| import { ActionHandler, TargetActionSupport } from '@ember/-internals/runtime'; | ||
| import { | ||
| ViewStateSupport, | ||
| ViewMixin, | ||
| ActionSupport, | ||
| ClassNamesSupport, | ||
| ChildViewsSupport, | ||
| CoreView, | ||
| } from '@ember/-internals/views'; | ||
| import { set, get } from '@ember/object'; | ||
| import { isTrackedProperty } from '@ember/-internals/metal'; | ||
| import { isCachedProperty } from '@ember/-internals/metal'; | ||
| import { default as inspect } from './lib/inspect'; | ||
| import { subscribe } from '../instrumentation'; | ||
| import { default as captureRenderTree } from './lib/capture-render-tree'; | ||
| import { registerHandler as registerDeprecationHandler } from './lib/deprecate'; | ||
| import * as GlimmerValidator from '@glimmer/validator'; | ||
| import * as GlimmerRuntime from '@glimmer/runtime'; | ||
| import { getOwner } from '@ember/owner'; | ||
| import RSVP from 'rsvp'; | ||
| import Service from '@ember/service'; | ||
| import { ENV } from '@ember/-internals/environment'; | ||
|
|
||
| export function setupInspectorSupport() { | ||
| if (typeof window !== 'undefined' && window.addEventListener) { | ||
| window.addEventListener( | ||
| 'ember-inspector-debug-request', | ||
| () => { | ||
| const event = new CustomEvent('ember-inspector-debug-response', { | ||
| detail: { | ||
| utils: { | ||
| libraries, | ||
| }, | ||
| runloop: { | ||
| _backburner, | ||
| cancel, | ||
| debounce, | ||
| join, | ||
| later, | ||
| scheduleOnce, | ||
| }, | ||
| object: { | ||
| cacheFor, | ||
| guidFor, | ||
| getOwner, | ||
| set, | ||
| get, | ||
| }, | ||
| debug: { | ||
| isComputed, | ||
| isTrackedProperty, | ||
| isCachedProperty, | ||
| descriptorForProperty, | ||
| descriptorForDecorator, | ||
| isMandatorySetter, | ||
| meta, | ||
| captureRenderTree, | ||
| isTesting, | ||
| inspect, | ||
| registerDeprecationHandler, | ||
| tagForProperty, | ||
| }, | ||
| classes: { | ||
| ActionHandler, | ||
| Service, | ||
| ComputedProperty, | ||
| EmberObject, | ||
| MutableArray, | ||
| Namespace, | ||
| MutableEnumerable, | ||
| NativeArray, | ||
| TargetActionSupport, | ||
| ControllerMixin, | ||
| CoreObject, | ||
| Application, | ||
| EmberComponent, | ||
| Observable, | ||
| Evented, | ||
| PromiseProxyMixin, | ||
| RSVP, | ||
| }, | ||
| VERSION, | ||
| ENV, | ||
| instrumentation: { | ||
| subscribe, | ||
| }, | ||
| Views: { | ||
| ViewStateSupport, | ||
| ViewMixin, | ||
| ActionSupport, | ||
| ClassNamesSupport, | ||
| ChildViewsSupport, | ||
| CoreView, | ||
| }, | ||
| glimmer: { | ||
| runtime: GlimmerRuntime, | ||
| validator: GlimmerValidator, | ||
| }, | ||
| }, | ||
| }); | ||
| window.dispatchEvent(event); | ||
| }, | ||
| false | ||
| ); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.