This is the second day of my participation in the August More text Challenge. For details, see:August is more challenging

Tanabata is coming, looking at the street of young men and women in pairs, the face is very stubborn show disdain, but the heart is silently sang again last year sing single love song. After all these years of being single, I finally became truly unhappy. The most afraid of people is to deny themselves, thinking and reflection for a long time, finally know why I become a single prince from single king.

The first stage day selected singleton

The first reason was because I loved singletons, and I wanted to be the only one in the world. I loudly tell the world that I am single by choice. I proudly despise the lovers of this world, sympathize with them for their loss of games, sympathize with them for their loss of freedom.

class SingleNumberOne {
    constructor(name) {
        this.name = name;
    }
    
    // Static methods
    static getInstance(name) {
      if(!this.instance) {
        this.instance = new SingleNumberOne(name);
      }
      return this.instance;
    }
    
    sayHi() {
        console.log('I am single by choice. I am unique in all the world.'); }}let singleOne = SingleNumberOne.getInstance('hui');
  let singleTwo = SingleNumberOne.getInstance('The first single dog in the Universe')
  
  console.log(singleOne === singleTwo); //true
  singleOne.sayHi();  // I am single by choice. I am unique in all the world
Copy the code

The second stage is unscrupulous agency

Later, I realized that freedom was useless, that play was a waste of time. I was just a lonely grass in this world. She’s the only one in this world, my girl of choice. Close to close again, like more like, but always dare not take that step thin confession. Finally, I found my good brother Xiao Wang and let him express my feelings to her for me.

const aHui = {
    sayHi: 'If you are out of water, I like you for a long time.'
};

const handler = {
    get(target, key) {
        return 'Hui says you're fine, but I'm gonna say this.'+ target[key]; }};const aWang = new Proxy(aHui, handler);
console.log(aWang.sayHi); // Hui said that you are very nice, but I have to say that if you are like the lotus, I like you for a long time
Copy the code

In the end there was no end, of course there was no result, and in the end Xiao Wang and she became lovers. Next door xiaowang is bad, I only blame myself for my shallow knowledge, do not understand Proxy, do not understand Proxy mode can do some other things.

Third stage mediator

A man can stretch and bend to be a man. Lost only one, and the other One. Put down a leaf, you can see the whole forest. I learned to take the initiative, flowers in the past, where there is not wet body.

I learned to tag girls, I had object management, and I was able to react differently depending on how beautiful or ugly the object was. It’s like I’m the center of the world deceiving men who play with women’s feelings.

// I have everything in the world
var Mediator = ( function(){
    var girls = {}, // Save all the communicators
        operations = {}; // Operations that can be performed by the broker
    
    operations.add = function( girl ) {
        girls[girl.isBeauty] = girls[girl.isBeauty] || [];
        girls[girl.isBeauty].push(girl);
    };

    // Communication failure or too ugly, block
    operations.lahei = function(girl) {
        var girlsArr = girls[girl.isBeauty];
        for(let i = 0; i < girlsArr.length; i++) {
            if (girlsArr[i].name === girl.name) {
                girlsArr.splice(i, 1);
                console.log(` you are${girl.name}Is blocked);
                break; }}}; operations.sayHi =function( girl ) {
        if (girl.isBeauty) {
            const words = ['Falling Goose and Sinking fish'.'Bright eyes and teeth'.'螓 head eyebrow '.Shuimu Qinghua.'Easy to see'.'Born beautiful'.'Tianxiang National Color'.'Apricot cheeks'.'Warm time'.'Peach face with Apricot Cheeks'.'Apricot rain pear Cloud'.'Drooling jade foam'.'Fish sinks and geese fall'.'Be happy, be angry'.'Beautiful Scenery'.'Distant Mountain Hibiscus'.'The colors of the world'.'Yu Xia Cheng Qi'.'Be pleased, be angry'.'Purple and red'.'Lips and teeth'.'Left home girl'.'Zhang Tai Willow'.'Gillian golden House'.'Close to the moon'.'Full of spring Scenery'.Spring is as deep as the sea.'Clouds are easy to disperse'.'Beautiful flowers'.'Fight the Beauquale'.'The most beautiful of all'.'Fine teeth'.'The beauty of the country'.'The face of the moon'.'The Most Beautiful Woman'.'Born beautiful'.'Wisdom quality orchid heart'.'Smart outside'.'Fragrance and sleeve'.'Close to the moon'.'Fish fall goose'.'Beautiful city'.'Gentle and graceful'.'Charming and charming'.'All manner of things'.'Gorgeous'.'The beauty of the country'.'Beauty and beauty'.'Bright eyes and bright teeth'.'Sweep away emei'.'Clean and elegant'.'Fragrance of flesh and skin'.'Pure and beautiful without vulgarity'.'Universal deportment'.'Gentle wind'.'Beauty shakes the earth']
            const idx = Math.ceil(Math.random() * words.length);
            console.log(` hui:${girl.name}You are${words[idx]}Let me forget ');
        } else {
            console.log('Hui: Yeah');
        }
        console.log('-- -- -- -- -- -- -- -- -- -- -- --');
    };
   
    var reciveMessage = function(){
        var message = Array.prototype.shift.call( arguments ); // Arguments the first argument is the message name
        operations[ message ].apply( this.arguments );
    };

    return {
        reciveMessage: reciveMessage
    }
})();

function Girl( name, isBeauty ){
    this.name = name;
    this.isBeauty = isBeauty;
};

Girl.prototype.sayHi = function(){
    console.log('Woman: Hi, hello, this is'.this.name);
    Mediator.reciveMessage('sayHi'.this ); // To send messages to men who cheat on women
};

Girl.prototype.lahei = function(){
    Mediator.reciveMessage('lahei'.this ); // To send messages to men who cheat on women
};

var meetGirl = function(name, isBeauty){
    var girl= new Girl(name, isBeauty);
    Mediator.reciveMessage('add', girl);
    return girl;
};

const xiaoqiao = meetGirl('Joe'.true);
const xisi = meetGirl('beauty'.true);
const diaocan = meetGirl('the sable cicada'.true);

xiaoqiao.sayHi();
xisi.sayHi();
diaocan.sayHi();

const dongshi = meetGirl('shi'.false);
dongshi.sayHi();
dongshi.lahei();

Copy the code

The effect is as follows:

Female: Hi, hello, I am Xiao Qiao Ahui: Xiao Qiao, you are so beautiful that I will never forget ------------ Female: Hi, hello, I am Xi Shi Ahui: Xi Shi, you are so beautiful and absolutely vulgar that I will never forget ------------ Female: Hi, hello, I am Diao Chan Ahui: The sable cicada, you are so WenWanXian shu, let me hard to forget -- -- -- -- -- -- -- -- -- -- -- -- woman: hi, hello, I am shi hui: well -- -- -- -- -- -- -- -- -- -- -- -- you are shi blockedCopy the code

As if to take off the single in that moment, but when the door one foot, Xi Shi and xiao Qiao a communication, found that I actually so many communications, real hammer cheating women’s feelings of men. So, draw water with a sieve, and finally it falls short. With the situation is not specific, management complexity is too high, the intermediary model is not suitable.

Stage 4 decoration is useless

Then what should I do? At this time, my roommate Xiao Zhou came and told me that you should learn to decorate yourself and not be so honest. That makes sense. I slapped the guy. Is the so-called god closed a door for me, but my brother opened a window for me. Finally I learned to decorate, I learned to install.

function handsome(target, name, descriptor) {
    const func = descriptor.value;
    if (typeof func === 'function') {
        descriptor.value = function(. args) {
            console.log('-- -- -- -- -- -)
            console.log('I'm handsome. I can play basketball.')
            const results = func.apply(this, args);
            returnresults; }}}class Person {
    @handsome
    sayHi() {
        console.log('-- -- -- -- -- -)
        console.log('Actually, I just have a lot of 💰')}}const aHui = new Person();
aHui.sayHi();
Copy the code

You read learned to dress up, become very 😎.

------ I am handsome and I can play basketball ------ in fact, I am just very 💰Copy the code

I also learned to connect the dots.

function humor(target, name, descriptor) {
    const func = descriptor.value;
    if (typeof func === 'function') {
        descriptor.value = function(. args) {
            console.log('-- -- -- -- -- -)
            console.log('I can tell bad jokes')
            console.log(A teenage dragon was beaten by his father because he peeked into a Jackie Chan movie. ')
            const results = func.apply(this, args);
            returnresults; }}}class Person {
    @humor
    @handsome
    sayHi() {
        console.log('-- -- -- -- -- -)
        console.log('Actually, I just have a lot of 💰')}}const aHui = new Person();
aHui.sayHi();
Copy the code

The serial skills are shown as follows:

------ I will tell bad jokes a minor dragon was beaten by his father, because it peeked Jackie Chan movie. ------ I am handsome and I can play basketball ------ in fact, I am just very 💰Copy the code

Note: The above code cannot be executed directly in the browser, you can follow the following steps

1, NPM install @babel/ core@babel/node@babel /plugin-proposal/decorators

Create.babelrc as follows:

{ “plugins”: [ [“@babel/plugin-proposal-decorators”, { “legacy”: true }] ] }

3. NPX babel-node filena.js

I thought that the bitter body and skin must be changed, but the sister said that she could not read my heart, and did not know what kind of soul I was. I hate god, I hate why didn’t I just tell my sister, I don’t have a soul, I’m just rich. I finally learned that I don’t need to pretend, but the girl left me.

The last

Spinning around in a trusiveness, living as a mortal, learning to design patterns, getting the computer, but single and lonely. Finally, The Chinese Valentine’s Day, I wish all shall be well, Jack shall have Jill, ruthless single people are happy.

Writing is not easy, welcome to like, collection, attention. Other articles that might interest you.

  • How many top-paying 40K jobs are there, and where are they located?
  • The front interviewer asked, “Can you build rockets?” I said, “Yes.”
  • Learn about Proxy’s good friend – Reflect, why Reflect

Welcome to follow the public account of the same name [Playing piano to Horse].