Giter Club home page Giter Club logo

classtrophobic-es5's Introduction

Classtrophobic ES5 build status Coverage Status

Project Classtrophobic can work on older browsers too.

No class or Proxy used in here, and the only caveat is that subclasses with a constructor must return the super instance.

var List = Class({
  extends: Array,
  constructor: function () {
    // super might promote current instance
    var self = this.super();
    // be sure you use the right reference
    self.push.apply(self, arguments);
    // and remember to return it
    return self;
  },
  push: function () {
    // constructor a part, everything else is the same
    this.super.push.apply(this, arguments);
    // make push chainable for demo purpose
    return this;
  }
});

Which Version For My Targets?

You can test live both classtrophobic and classtrophobic-es5. If the page turns out green, you're good to go!

The main difference is that ES5 version has a greedy runtime when it comes to super usage, while this original version uses real classes and delegate to Proxy access the super resolution, working only when a method is accessed and per single method, as opposite of runtime setup for all methods in the es5 case.

Luckily overrides are not the most frequent thing ever.

Requirements

At least the annex B __proto__ accessor should be there. This means pretty much every Mobile browser and every Desktop one, starting from IE11.

classtrophobic-es5's People

Contributors

webreflection avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

classtrophobic-es5's Issues

observedAttributes implementation

How would you implement v1 observedAttributes static property using v1 customElements and Classtrohpobic-es5?

I tried several things but had to fallback to something custom like

			var descriptor = {
			key: 'observedAttributes',
				get: function get() {
					return ['test']; // array of attributes to observe
				}
			};		
			descriptor.enumerable = descriptor.enumerable || false; 
			descriptor.configurable = true; 
			if ("value" in descriptor) descriptor.writable = true; 
			Object.defineProperty(ElementConstructor, descriptor.key, descriptor); 	

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.