made with esnextbin
Last active
June 2, 2016 20:13
-
-
Save agonbina/e7eb2c9d20348a82795c116771ccb3be to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
<script src="https://rawgit.com/StyleT/js-acl/master/dist/acl.js"></script> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
<div id="app"></div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DataStore, Mapper, Record, Collection } from 'js-data' | |
const store = new DataStore() | |
const User = store.defineMapper('user') | |
const user = User.createRecord({ username: 'agonbina' }) | |
user.username = 'test' | |
user.name = 'agon' | |
console.log(user.hasChanges('last')) | |
console.dir(user) | |
class Units extends Collection { | |
constructor() { | |
super(arguments) | |
console.log(arguments) | |
} | |
} | |
const units = new Units() | |
units.on('huh', message => console.log(message)) | |
units.emit('huh', 'huh') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"js-data": "3.0.0-beta.6", | |
"babel-runtime": "6.9.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | |
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | |
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | |
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | |
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | |
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | |
var _inherits2 = require('babel-runtime/helpers/inherits'); | |
var _inherits3 = _interopRequireDefault(_inherits2); | |
var _jsData = require('js-data'); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var store = new _jsData.DataStore(); | |
var User = store.defineMapper('user'); | |
var user = User.createRecord({ username: 'agonbina' }); | |
user.username = 'test'; | |
user.name = 'agon'; | |
console.log(user.hasChanges('last')); | |
console.dir(user); | |
var Units = (function (_Collection) { | |
(0, _inherits3.default)(Units, _Collection); | |
function Units() { | |
(0, _classCallCheck3.default)(this, Units); | |
var _this = (0, _possibleConstructorReturn3.default)(this, (0, _getPrototypeOf2.default)(Units).call(this, arguments)); | |
console.log(arguments); | |
return _this; | |
} | |
return Units; | |
})(_jsData.Collection); | |
var units = new Units(); | |
units.on('huh', function (message) { | |
return console.log(message); | |
}); | |
units.emit('huh', 'huh'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment