Web Components in Dart - dart

I've got a few questions considering web-components in Dart:
1.) How can we call a method of a component and foremost, how to get access to the component instance? I know we can supply properties to web components but not how to call methods on them and get their instance.
2.) How is it possible to manually instantiate an instance of a component? The reason is that I want i.e. to show a modal form containing my component and on each click want to have the web component to be re-created to show fresh content.
thanks
alex

For 1.) Seems it is done via document.query('#my-component-id').xtag
For 2.) Seems that's possible by code but overly complex as of now
See also http://www.dartlang.org/articles/dart-web-components/spec.html for more info

Related

Is there a similar thing like EventFiringWebDriver to PlayWright automation?

My objective is to log all the interactions with the web elements in PlayWright automation. I need to capture the following interactions
Click/Submit
Select dropdown
Check Box
Text filling
Radio button
Toggle button
Something like as shown here https://blog.testproject.io/2018/06/04/event-listeners/
Hope it helps what I am trying to achieve, please do comment if further information is required.
Thanks.
Write wrapper functions over library functions to log desired details
Write wrapper functions over each UI action and which will write the specific action performed detail on an generally external file for later reference on post execution.
On the script level these wrapper functions will be called and all library functions will be called indirectly.
This is the standard advise to keep it DRY as there will be hardly 10-15 primary functions covering most of the UI actions and will encapsulate all the required logging & reporting functionality in one place.

Communicating single-spa container app to angular child app

I need a help to communicate from my container single-spa to loaded angular app ( child ). when user click on parent app ( spa-container ) option, that should communicated to child application to change the mode.
it will not happen very frequently. But not able to find a way to communicate from container to loaded angular application.
there is a detail given by spa itself : spa-communication detail but not clear and there is no detailed steps. any one help me?
I'm one of the maintainers of single-spa.
We tend to be light on our opinions in the documentation about how to implement communication between modules because there are a lot of ways to implement it and each comes with pros/cons. In the situation you described it sounds like you might want to explore option #3 from the link you posted.
Custom Browser events
In the parent you fire custom events on the window. API on MDN.
Quick example
// in the parent (usually called the single-spa config or root-config in the documentation)
const event = new CustomEvent("myEvent", {favoriteMovie: 'StarWars'})
window.dispatchEvent(event)
// in the child (or registeredApplication)
window.addEventListener("myEvent", myEventHandlingFunction)
function myEventHandlingFunction(e) {...}
That should at least get you started, there are other options for communication as well and this particular approach isn't going to be the best solution in every situation.
It's also worth noting that customEvents don't work in IE11 unless you include a polyfill.

Umbraco automatic update

I need some help with umbraco.
Let's say that I have an umbraco grid with a custom editor, just like the one in this tutorial: https://our.umbraco.com/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Grid-Layout/build-your-own-editor
Ok, so I wrote this editor to build a gallery of items with image/title, I get the item list from an api call made by an angular service and this works fine when I publish the page by hand. What I want is to automatically update this gallery with new items where available, so my idea was to make a timed ajax call, let's say every hour, to update the items. But sadly this doesn't work, I suppose that the call is made but the list isn't updated.
Any suggestion? Thanks
You need to handle this differently. Right now it sounds like what you have is an implementation that works when you are browsing to this node in the backoffice using your browser and the browser makes the API calls through Angular. This all happens in your UI and when you manually hit save/publish - the data in the UI gets saved. Keep in mind that this is basically your browser doing the "work" - and this (and all other Angular code) will of course only ever run while your browser is open, in the backoffice, viewing this node.
What you want to do is to have this run automatically (and preferably in some sort of background task) to ensure that you do not really have to open up the backoffice for this to actually be automatically updated over time.
You need to create some sort of background job running on the server-side instead. This would have to be done in C# and I would recommend looking into Hangfire or Quartz frameworks to handle all the scheduling/making sure the job runs.
This job/task should do the external API calls in C# and transform the result into the same format as the format you are saving when you save data from the manual update. Then fetch the content nodes you need to update using the ContentService API and update the specific property values on those nodes. When this is done you need to make sure the changes are saved and the node is then republished with its updated data. All of this is done through the ContentService.

How to refresh all (OData) bindings of a given SAPUI5 page?

I have a bigger SAPUI5 application with multiple pages.
If user navigates through all these pages, they will reside in memory of course.
Now I have the problem that some of these pages have a complex context with several bindings to an ODataModel. That leads to the problem that a .refresh() call on the underlying ODataModel take some time.
Because: all known bindings will be reloaded (also from pages not currently shown)
Now I am searching for a better solution to refresh the ODataModel.
The refresh must be done because sometimes a client action triggers the server to updates multiple data (in different models!).
Further information (Edit)
I am using multiple ODataModels in my application and they are created in the Component.js (as suggested in the Best practice chapter of the SDK documentation).
Navigating through the pages will increase the cached data in the ODataModel.
Calling a .refresh() seems to reload all cached data (still used or not).
According to the first reply it is possible to refresh one binding but how to refresh all bindings of a given view/page with multiple models?
Would it be the right way to set multiple instances of the ODataModel for each view? And just call the .refresh() method there? But also on this scenario the locally cached data will increase over time?
Any ideas welcome :)
You can access the binding of a specific UI control and call refresh there. This should just process this specific binding.
My first hint would be to use the v2 OData Model (sap.ui.model.odata.v2.ODataModel), as it uses the Batch Mode by default.
Moreover, when it performs updates, it refreshes all bindings of entities that have been updated automatically so you should not need to refresh the whole model at all.
For me it worked to just re-bind that binding on a specific element in the view as I did earlier to create it at all.
We had an update-problem after another update call had side effects on the information in question, but a refresh on the binding of the elemnt itself did not solve that. I guess there were no local changes to that path in the model, so there was nothing to refresh. But on server-side there where updates the model/Cache didn't know about. Rebinding made my day, and also only the one necessary call to the servcie was made.

WindowsPhone not refresh/update listbox

i m writing an app where i has created an web service in local network.I m able to grab resources provided by service in android, wp7.1 and ios5.
But i faces a problem, in wp7.1 and ios5 in refreshing the list box and the uitableview controller respectively.
Actually the data source get update in both of this platform but it didn't refresh/update the view which is very important.
if any expertize knows about my problem in depth please help me out from this.if any body has sample code related to updating the view according to the web service kindly help.
i have a solution for this problem in wp7.
may be your web service call fetches the data from catch for the same service call.
try to add current time to show your web service request as new one.
like ".....?&currenttime=...."
try this.
You mention both view and controller so I'm guessing you are using some form of MVVM pattern.
For the controller to update the view a number of things must happen:
The controller must be the DataContext for the view. Most MVVM frameworks handle this plumbing for you.
The controller property that the listbox in the view is bound against must have NotifyPropertyChanged called or must be an ObservableCollection.

Resources