This file contains 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
function Notification() { | |
this.notifs = ['A', 'B', 'C'] | |
this.readNotifs = ['B'] | |
this.isPublic = false | |
} |
This file contains 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
var Notification = function () { | |
this.notifs = ['A', 'B', 'C'] | |
this.readNotifs = ['B'] | |
this.isPublic = false | |
} | |
Notification.prototype = { | |
markNotifsRead: function() { | |
//Mark notification read | |
} |
This file contains 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
var eventsNotifs = new Notification(); | |
console.log(eventsNotifs.notifs); // Output: A, B, C | |
eventsNotifs.markAllNotifsRead(); // Mark all notification as read |
This file contains 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
const path = require('path'), | |
AssetsPlugin = require('assets-webpack-plugin'), | |
HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
devtool: 'inline-source-map', | |
entry: './client/index.js', | |
output: { | |
filename: '[name].bundle.js', | |
path: path.resolve(__dirname, 'build/client'), |
This file contains 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
... | |
devtool: '', // Removed dev-tools mapping | |
entry: './client/index.js', | |
output: { | |
filename: '[name].bundle.js', | |
path: path.resolve(__dirname, 'build/client'), | |
publicPath: 'build/client' | |
}, | |
... |
This file contains 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
... | |
plugins: [ | |
new BrotliPlugin({ | |
asset: '[path].br[query]', | |
test: /\.(js|css|html|svg)$/, | |
threshold: 10240, | |
minRatio: 0.8 | |
}) | |
], | |
... |
This file contains 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
... | |
optimization: { | |
splitChunks: { | |
cacheGroups: { | |
commons: { | |
test: /[\\/]node_modules[\\/]/, | |
name: 'vendors', | |
chunks: 'all' | |
} | |
} |
This file contains 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
const path = require('path'), | |
webpack = require('webpack'), | |
AssetsPlugin = require('assets-webpack-plugin'), | |
BrotliPlugin = require('brotli-webpack-plugin'), | |
HtmlWebpackPlugin = require('html-webpack-plugin'), | |
UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | |
const isProd = process.env.NODE_ENV === 'production'; | |
/** |
This file contains 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
function newFunction(funcName, args) { | |
// Copy the function prototype to object | |
let obj = Object.create(funcName.prototype) | |
// Call constructor function with supplied arguments, and assign this to newly created object | |
funcName.call(obj, args) | |
// return newly created object | |
return obj | |
} | |
This file contains 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
function MinHeap() { | |
this.arr = new Array() | |
} | |
MinHeap.prototype.push = function push(data, weight) { | |
this.arr.push({ data, weight }) | |
if(this.arr.length <= 1) return | |
let current = this.arr.length - 1 | |
let parent = Math.floor(current/2) |
OlderNewer