Skeletons
This commit is contained in:
parent
c3443b5725
commit
8df7431743
|
@ -3,7 +3,7 @@
|
|||
"use strict";
|
||||
|
||||
var electron = require("electron");
|
||||
var src_js_modules_modules, src_js_utils, src_js_api, src_js_event, src_js_core;
|
||||
var src_js_modules_observermodule, src_js_modules_modules, src_js_utils, src_js_api, src_js_plugin, src_js_event, src_js_core;
|
||||
var _createClass = function () {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
|
@ -28,10 +28,32 @@
|
|||
throw new TypeError('Cannot call a class as a function');
|
||||
}
|
||||
}
|
||||
src_js_modules_modules = function () {
|
||||
var modules = {};
|
||||
return modules;
|
||||
src_js_modules_observermodule = function () {
|
||||
var Observer = function () {
|
||||
function Observer() {
|
||||
_classCallCheck(this, Observer);
|
||||
this.mutationObserver = new MutationObserver(this.observe);
|
||||
this.mutationObserver.observe(document, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
}
|
||||
_createClass(Observer, [{
|
||||
key: 'observe',
|
||||
value: function observe(mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
BD.event.emit('raw-mutation', mutation);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return Observer;
|
||||
}();
|
||||
return new Observer();
|
||||
}();
|
||||
src_js_modules_modules = function (observerModule) {
|
||||
var modules = { observerModule: observerModule };
|
||||
return modules;
|
||||
}(src_js_modules_observermodule);
|
||||
src_js_utils = function () {
|
||||
var Utils = function Utils() {
|
||||
_classCallCheck(this, Utils);
|
||||
|
@ -44,39 +66,72 @@
|
|||
};
|
||||
return new Api();
|
||||
}();
|
||||
src_js_event = function () {
|
||||
var eventEmitter = new require('events').EventEmitter;
|
||||
var event = function () {
|
||||
function event() {
|
||||
_classCallCheck(this, event);
|
||||
src_js_plugin = function () {
|
||||
var Plugin = function () {
|
||||
function Plugin(args) {
|
||||
_classCallCheck(this, Plugin);
|
||||
this.info = args;
|
||||
}
|
||||
_createClass(event, [
|
||||
_createClass(Plugin, [
|
||||
{
|
||||
key: 'author',
|
||||
get: function get() {
|
||||
return this.info.author;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
get: function get() {
|
||||
return this.info.name;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'version',
|
||||
get: function get() {
|
||||
return this.info.version;
|
||||
}
|
||||
}
|
||||
]);
|
||||
return Plugin;
|
||||
}();
|
||||
return Plugin;
|
||||
}();
|
||||
src_js_event = function () {
|
||||
var EventEmitter = events.EventEmitter;
|
||||
var Event = function () {
|
||||
function Event() {
|
||||
_classCallCheck(this, Event);
|
||||
this.eventEmitter = new EventEmitter();
|
||||
}
|
||||
_createClass(Event, [
|
||||
{
|
||||
key: 'on',
|
||||
value: function on(eventName, callback) {
|
||||
eventEmitter.on(eventName, callback);
|
||||
this.eventEmitter.on(eventName, callback);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'emit',
|
||||
value: function emit() {
|
||||
return 'Not allowed';
|
||||
var _eventEmitter;
|
||||
(_eventEmitter = this.eventEmitter).emit.apply(_eventEmitter, arguments);
|
||||
}
|
||||
}
|
||||
]);
|
||||
return event;
|
||||
return Event;
|
||||
}();
|
||||
return new event();
|
||||
return new Event();
|
||||
}();
|
||||
src_js_core = function (modules, utils, api, plugin, event) {
|
||||
var Core = function () {
|
||||
function Core(args) {
|
||||
_classCallCheck(this, Core);
|
||||
console.log(event);
|
||||
this.event = event;
|
||||
this.modules = modules;
|
||||
this.beta = true;
|
||||
this.alpha = true;
|
||||
this.plugin = plugin;
|
||||
this.event = event;
|
||||
this.eventEmitter = event.eventEmitter;
|
||||
}
|
||||
_createClass(Core, [
|
||||
{
|
||||
|
@ -103,8 +158,8 @@
|
|||
window.$B = function (s) {
|
||||
return $('[data-bd=' + s);
|
||||
};
|
||||
var BD = new Core();
|
||||
window.BD = new Core();
|
||||
BD.init();
|
||||
}(src_js_modules_modules, src_js_utils, src_js_api, src_js_event);
|
||||
}(src_js_modules_modules, src_js_utils, src_js_api, src_js_plugin, src_js_event);
|
||||
|
||||
}());
|
|
@ -38,7 +38,7 @@ const _resources = {
|
|||
"jQuery": {
|
||||
"path": "vendor",
|
||||
"filename": "jquery-2.2.4.min.js",
|
||||
"var": "window.BD.$ = window.BD.jQuery"
|
||||
"var": "window.$ = window.jQuery"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -13,17 +13,19 @@ define([
|
|||
"./modules/modules",
|
||||
"./utils",
|
||||
"./api",
|
||||
"./plugin",
|
||||
"./event"
|
||||
], (modules, utils, api, plugin, event) => {
|
||||
|
||||
class Core {
|
||||
|
||||
constructor(args) {
|
||||
console.log(event);
|
||||
this.event = event;
|
||||
this.modules = modules;
|
||||
this.beta = true;
|
||||
this.alpha = true;
|
||||
this.plugin = plugin;
|
||||
this.event = event;
|
||||
this.eventEmitter = event.eventEmitter;
|
||||
}
|
||||
|
||||
init() {
|
||||
|
@ -42,7 +44,7 @@ define([
|
|||
|
||||
window.$B = s => { return $(`[data-bd=${s}`); };
|
||||
|
||||
const BD = new Core();
|
||||
window.BD = new Core();
|
||||
BD.init();
|
||||
|
||||
|
||||
});
|
|
@ -11,19 +11,23 @@
|
|||
|
||||
define(() => {
|
||||
|
||||
const eventEmitter = new require('events').EventEmitter;
|
||||
|
||||
class event {
|
||||
const EventEmitter = new require('events').EventEmitter;
|
||||
|
||||
class Event {
|
||||
|
||||
on(eventName, callback) {
|
||||
eventEmitter.on(eventName, callback);
|
||||
constructor() {
|
||||
this.eventEmitter = new EventEmitter;
|
||||
}
|
||||
|
||||
emit() {
|
||||
return "Not allowed";
|
||||
on(eventName, callback) {
|
||||
this.eventEmitter.on(eventName, callback);
|
||||
}
|
||||
|
||||
emit(...args) {
|
||||
this.eventEmitter.emit(...args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new event();
|
||||
return new Event();
|
||||
});
|
|
@ -8,9 +8,13 @@
|
|||
* License: MIT
|
||||
*/
|
||||
|
||||
define([], () => {
|
||||
define([
|
||||
"./observermodule"
|
||||
], (observerModule) => {
|
||||
|
||||
var modules = {};
|
||||
const modules = {
|
||||
observerModule: observerModule
|
||||
};
|
||||
|
||||
return modules;
|
||||
});
|
|
@ -0,0 +1,34 @@
|
|||
/* BetterDiscordApp Client Observer
|
||||
* Version: 2:1.0
|
||||
* Author: Jiiks | https://jiiks.net
|
||||
* Date: 31/10/2016
|
||||
* Last Update: 31/10/2016
|
||||
* Github: https://github.com/Jiiks/BetterDiscordApp
|
||||
* Git: https://github.com/Jiiks/BetterDiscordApp.git
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
define([], () => {
|
||||
|
||||
class Observer {
|
||||
|
||||
constructor() {
|
||||
this.mutationObserver = new MutationObserver(this.observe);
|
||||
this.mutationObserver.observe(document, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
}
|
||||
|
||||
observe(mutations) {
|
||||
|
||||
mutations.forEach(mutation => {
|
||||
BD.event.emit("raw-mutation", mutation);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new Observer();
|
||||
});
|
Loading…
Reference in New Issue