How to use the core-decorators.mixin function in core-decorators

To help you get started, we’ve selected a few core-decorators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GuoYongfeng / github-notetaker-app / app / containers / Profile / Profile.jsx View on Github external
import React, { Component } from 'react';
import { UserProfile, UserRepos, Notes } from '../../components';
import { mixin } from 'core-decorators';
import ReactFireMixin from 'reactfire';
import Firebase from 'firebase';
import getGithubInfo from '../../util/helper';

@mixin(ReactFireMixin)
class Profile extends Component {
  state = {
    notes: ['1', '2', '3'],
    bio: {
      name: 'guoyongfeng'
    },
    repos: ['a', 'b', 'c']
  }
  componentDidMount(){
    // 为了读写数据,我们首先创建一个firebase数据库的引用
    this.ref = new Firebase('https://github-note-taker.firebaseio.com/');
    // 调用child来往引用地址后面追加请求,获取数据
    var childRef = this.ref.child(this.props.params.username);
    // 将获取的数据转换成数组并且赋给this.state.notes
    this.bindAsArray(childRef, 'notes');
github fs / backbone-base / app / src / collections / articles.js View on Github external
import { mixin } from 'core-decorators';
import Article from 'models/article';
import PaginatedCollection from 'collections/paginated';

@mixin({
  url: 'articles',
  model: Article
})
export default class Articles extends PaginatedCollection {}
github fs / backbone-base / app / src / views / dashboard / dashboard.js View on Github external
import Marionette from 'backbone.marionette';
import { mixin } from 'core-decorators';
import Session from 'services/session';
import DashboardItemView from 'views/dashboard/item';
import template from 'templates/dashboard/dashboard';

@mixin({
  template,
  className: 'jumbotron',
  childViewContainer: '.articles-list',
  childView: DashboardItemView,
  model: Session.currentUser()
})
export default class DashboardView extends Marionette.CompositeView {}
github fs / backbone-base / app / src / models / comment.js View on Github external
import { mixin } from 'core-decorators';
import SessionModel from 'models/session';

@mixin({
  urlRoot: 'comments',

  validation: {
    text: {
      required: true
    }
  }
})
export default class Comment extends SessionModel {}
github fs / backbone-base / app / src / collections / comments.js View on Github external
import { mixin } from 'core-decorators';
import Comment from 'models/comment';
import AppCollection from 'collections/app';

@mixin({
  model: Comment
})
export default class Comments extends AppCollection {}

core-decorators

Library of JavaScript stage-0 decorators (aka ES2016/ES7 decorators but that's not accurate!) inspired by languages that come with built-ins like @​override, @​deprecate, @​autobind, @​mixin and more! Works great with React/Angular/more!

MIT
Latest version published 7 years ago

Package Health Score

56 / 100
Full package analysis

Popular core-decorators functions