Snippets

Synolia ECOM - ORO - Exemple type objet VS prototype : Oro-platform UIBundle (OroCommerce)

Created by Yann BERGES

File src/Acme/DemoBundle/Resources/public/js/app/components/my-component.js Added

  • Ignore whitespace
  • Hide word diff
+define(function (require) {
+    'use strict';
+
+    var MyComponent,
+        BaseComponent = require('oroui/js/app/components/base/component');
+
+    MyComponent = BaseComponent.extend({
+        /**
+         * La propriété "identityProto" est propre au prototype
+         */
+        identityProto: {
+            name: 'No name'
+        },
+        
+        initialize: function (options) {
+            // La propriété "identity" est propre à l'instance
+            this.identity = {
+                name: 'No name'
+            };
+        }
+    });
+
+    return MyComponent;
+});
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.