Implementing JavaScript Web API Interfaces -


(and its descendants, such as etc.) is defined according to the interface.

If I want to implement these interfaces with TypeScript, I can do the following.

  class applies CustomElement HTMLElement {// execution}   

However implementing the interface in type-scripts does not generate any code, so pure JavaScript How to get the interface implementation difficult is easy.

How should these interfaces be implemented with pure JavaScript?

You will use the prototype of HTMLElement

  var customization = function {} {}; CustomElement.prototype = HTMLElement.prototype;   

and now you can create them by using new keyword

  var myElement = new CustomElement (); // myElement will now use HTMLElement prototype    

Comments

Popular posts from this blog

c - Performance of System() -

python - how we can use ajax() in views.py in django? -

sql server - How to use pivot in this table -