Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Create PrimalClay for easier mixin and proxying #12

Open
twolfson opened this issue Jan 18, 2013 · 2 comments
Open

Create PrimalClay for easier mixin and proxying #12

twolfson opened this issue Jan 18, 2013 · 2 comments

Comments

@twolfson
Copy link
Collaborator

_PAST NOTES_

My first thought was this belongs in public/js but controllers seems best. Anyway, this is the most basic of basic that allows for easy mixins and proxying.

// HtmlController.js
define(['mvc!c/PrimalClay'], function (PrimalClay) {
  function HtmlController(params) {
      // Normal stuff except none of that for (; i < mixins.length; i++) business
   }

  // Get the primal clay format of the HtmlController
  var pHtmlController = PrimalClay(HtmlController);

  // Add in the nav mixin
  pHtmlController.addMixin('nav', 'function (params) {
    // nav mixin stuff

    // with sugar for proxy (start is not actually start, just a wrapper function for the initial call)
    PrimalClay.proxy(params, 'start', function (start) {
      data.clear();

      // Automatically coerce arguments to an array, automatically return start.apply(this, args);
      start.array(arguments);
    };
  });
});
@twolfson
Copy link
Collaborator Author

Mixin part is done but I have no ideas on how to make proxying thinner at the moment =(

@twolfson twolfson reopened this Mar 17, 2013
@twolfson
Copy link
Collaborator Author

Almost closed -- realized proxy comment is still true >_<

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant